I have a menu block to the right of my content area. I want to be able to click on one of the links and have the content in the content area change, whether that be to advance a nodeque to the matching content type or just diplay a block containing that one content type.
I would usually do this with php, by adding a url variable site.com/data?uid=somenumber to display the data i want on the same page. I don't want to have to create multiple content pages to do this. There has to be a way that the links that are created and displayed in the menu block can just change the content inside the view displayed on the page.
Im a total drupal newb. So any help would be incredibly appreciated.
Thanks in advance.
If your content area is displaying a view, you can definitely do this using views arguments. So, for example, if you want the menu links to vary the view content based on different terms, you can set up your view to expect an argument from the url.
To set it up:
Add a 'Contextual filter' to your view (under the 'Advanced' section)
In my example below, I've added 'region' as my contextual filter, which is just a term reference on my content type
When configuring the contextual filter, set it up such that when the filter is not present in the URL, it just displays all values (that's the default) -- shown in screenshot.
4.
This way, when you first load the page, and no menu item has been selected, all your content will show in the view. Now you'll have to set up your menus to provide the argument, and your view should react appropriately!
Let me know if that works or if you have any questions.
Related
Case is that im using views for displaying each of content-types.
eg. q=?news/12 for news by nid
q=?product/13 for products by nid
Problem is when im creating (or editing) new content, it automatically displays (or refer) ?node/14 instead of ?product/14. Also menu link is created under node/14 link.
How could i set each view to referring content type?
Thanks in advance.
You can create a view (display mode : page) for each content type, which displays datas from your node (fields or whatever you need). To do so, add a contextual filter in your view, on content nid, give default value : content nid from url. Then give to this view a url like "/news/%". So "/news/12" hits this view and grabs data from news content type with id 12. Then you can manually modify menu link, or use pathauto to specify /news/[node:nid] as a pattern for all your news nodes (I never tried all this stuff together but it should work).
Other solution : https://www.drupal.org/project/contemplate (seems deprecated...)
Other solution : create a .tpl for your content type nodes : node--news.tpl.php, but no more views...
Other solution : create a view displaying one particular node data (like I explain first with a contextual filter), this view creates a block (display mode : block), you assign this block to a region (with block interface), and set this block to be displayed only for the news content type (last menu on the left on the block configuration page). Then with Display Suite you hide everything for this content type on the full content display. So on each node page which refers to a "news" node, you have nothing in your page but your block (and the node title, which you can remove with display suite extras I guess).
Good luck with it
I want to make a long page consisting of multiple nodes (each of the same Content Type). The page should have navigation on top of it that will allow to jump directly to the desired point of the long page, kind of like here: http://www.apple.com/macbookpro/features.html (there navigation is under the picture)
I used the Views module to assemble a long page from content, and for navigation I tried to use another View of the same content, only inserted in the top of the page as a block. I set this view to display grid of fields; it looks good. Only I could not figure out how to make each cell in the grid to become a link to the content on the same page.
I tried modifying views template, but there $rows variable turned out to be a string with already assembled html. Maybe I could possibly modify the content template, and insert some sort of condition that will change the way content looks based on what part of the page current view is located, but I am not sure how to do that either.
In the views, edit the field selected, and there are options there to configure the field as hyperlinks how you may want them. Also you can just let the field link directly to the node, there is an option for that. cheers
I have some Views which display specific content types.
On these views I want to display a block containing a menu.
What I have found is that I can restrict the block containing the menu to certain pages and include the views in those pages, and this works fine but when a user clicks on the teaser through to the actual article it is no longer in the page list and so doesn't display the menu.
I can also restrict the menu block to specific content types in which case the situation is reversed i.e. it displays on the page containing the node (because it is of the content type) but not on the page containing the view.
Is there a way I can display a block so that it meets both a specific page criteria and a content type criteria?
If I'm understanding you correctly... In the block's configuration page you can choose which pages to show the block. If your content type was article, and your view was a page display with a path of path/to/view, you could use settings like this:
First take a look at my node setup here: http://imgur.com/a/DJdRw
The first image is my Subpage slider content type which accepts multiple images and will essentially be my slideshow.
Second image is the default page, but I added a node reference to the Subpage slider node. It allows you to associate a particular slideshow to a page.
The last image I was messing around with Views and Views Slideshow, but I don't know what I'm doing. I managed to get images displayed, but as you can see it displays the images of a long vertically. I set the Views slideshow and it creates a slide between multiple nodes and not the multiple images in ONE node.
Where do I go from here?
Thanks
To display a block with a slideshow of images (from a referenced node) when viewing a page
I have come up with a much easier ("duh" moment) way of doing this. I created the functionality on a fresh Drupal install. Assuming you have the following modules: CCK (w/ Node Reference enabled), Views, Views Slideshow, FileField, ImageField.
Create your content types (in this case: slider and using the core page type)
Add an imagefield to the slider content type (field should be named field_images)
Add a node reference field to the core page content type (field should be named field_slide_ref)
Edit the node reference field settings (can remove "Required" if you like)
Create a new view called slideshow
In the slideshow view:
Change Basic Settings->Style to "Slideshow"
Add the field "Content: images" (choose Format: Image at bottom, unless using ImageCache)
Add an argument of "Node: Nid" with the settings:
Add a "block" display
Enable your new block labeled "slideshow: Block" at example.com/admin/build/block
If configured correctly, when viewing a page with the _slide_ref_ field referencing a slider node, you should see the slideshow displayed in the block.
Old Solution...
To display a referenced slideshow inside the page node being viewed:
Download, install and enable the View Reference module
Create your content type with multiple images (Subpage slider) [Done]
Create a new "page" view in Views UI. Add the field Content: YOUR_IMAGEFIELD (from Subpage slider) important: don't group the images, under Basic Settings->Style choose "Slideshow" and add an Argument of Node: nid choosing Provide default argument->Node ID from URL as argument settings
Create a view reference field on your page content type where you want to see the slideshow and select the view(s) that can be referenced and in the "Arguments" fieldset check: Allow delimiter seperated values and click "Save field settings"
Now when you create a default page there will be a view reference field to select the view you want to use and an argument field where you can input the node id of the node with your images you want to show as a slideshow in your page.
THE QUICK SOLUTION: a really simple tweak which the Views Slideshow docs should put in lurid bold gothic writing:
If you want to slideshow multiple images from an image field of one node ** don't forget to untick the "Group multiple values" checkbox in the settings for your-view>Fields>your-image-field **
This outlines how to make a slideshow of images that are taken from one node. The main point here is that you have to make a block that has an argument of node id taken from the url. I used this to make a slideshow showing as a block in the main content area, but you can of course put the block anywhere.
Modules:
CCK
imagefield
views
views_slideshow OR jCarosel
Create your Content Type with an image field, allowing multiple values.
Create content with multiple images, distinct enough so that you can tell if the images are from one particular node or another node
Create a new view as a node.
Create a Block display
Give your block a name (under Block Settings, left column)
Filter as: published, as your Content Type and with the image field (important - see last step why).
Field: your image field.
Make sure to uncheck the 'Group multiple values' checkbox
Display as an image, or an imagecache preset. Whatever you like
Add an argument:
Node: NID
For 'Action to take if argument is not present', select 'Provide Default Argument'
Node ID from URL
Under 'Basic Settings' select
If using views_slideshow, select the Style to be: Slideshow (Single-frame).
Items to display: unlimited
Save your View
Go to your Blocks page (/admin/build/block) and place your newly created block into the main content area (or wherever you want it to be). If you need to set the visibility on the actual block itself (/admin/build/block) then go ahead but otherwise only nodes of the content type that has multiple images will show the slideshow of images, while other pages on your site will not. This is why it is important to set a specific filter and to use the argument.
Done!
Essentially, this does not work as a page but has to be a block. The slideshow will use the NID to see what images are in that node and create a slideshow of those only.
Should work the same in Drupal 7 but have not tested this.
The solution is to add as argument not the 'node id' but the 'slideref field' and provide default argument 'nid by url' and the slideshow by node will work.
You can use the Views Nivo Slider as well.
Let's suppose I have created a view that shows some kind of stories.
But I want to show this view in a left-hand bar — not a link to the view, but the view itself.
How can I connect my new view with a fixed block position?
I want to be able to show real view data in various places on my page.
Is it possible or I am limited only to central area and links to views from menu?
Using Views 2.x for Drupal 6.x it's simple to create a block from a view. Every view has a set of 'default' settings and some number of display settings. A display can be a page, a block, a feed or anything else that creative module authors.
To make a block from your view, you just "Add Display" of type "block", override any settings that you want changed in the block (IE - display less items, just a node title, whatever). You then have a block that you can place like any other Drupal block.
edit: Answer to "Can you limit stories to ones that are tagged"? Sure thing. You just add a filter for Taxonomy terms.
Getting a view to display in a block is easy. Once you have created a view and assigned the view as a block position you simply head to blocks in your admin and you'll see the view.
Just select the block and save it. Simple.
If your view doesn't show, check your filters and that the view fields are correct. Usually if they are not showing it is something simple like selecting content published = yes.
You can create views as pages or blocks. As you're not telling exactly which Drupal/Views version you're working with, all I can tell so far is that, after you create the view, you can tell it to display as a block or as a page.
Then go to the blocks settings and set that to the position you want.