Drupal: display views page instead of default node/% - drupal

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

Related

Dyamic menu links how to

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.

How do I display a block matching page and content type criteria?

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:

Unable to use multiple images in a single node to create a a slideshow in Views

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.

How to assign view block to dynamic taxonomy term page for CCK entries

http://localhost/rkk/work-type/non-profit
I created a vocabulary and terms under for work-type. and I created some posts...
Then I created a View Block to list my entries, and assigned to a page... everything fine so far.
I display the work-type at entry details page. and I have a link "click to see other non-profit(assigned work type) works". When I click this link, it lists entries assigned to that particular work-type. thats fine, but it displays title/body/readmorelink :/ I need custom view for this page, like I did View Block for listing all posts...
Can I assign custom created View Block to this taxonomy entry list page? the url changes according to work-type, so how do I assign view to changing-url :/
Appreciate helps!! thanks a lot!
UPDATE FOR MORE INFO:
I have a vocabulary (work type), and terms under (corporate, non-profit, etc...)
I have a CCK for "work", and as a field I have select terms of work-type vocabulary.
I have a Custom Views Block to display works in a page (thumb, title, desc, link, etc.).
When I click a work, it goes to particular Work entry details page, I place a link in there "click to see other -term (corporate)- works", etc.
When I click this link, it displays the Work Entries under that particular term. it works fine. but it displays as default look (shown as below), but I need this page same as main works page list (thumb, title, desc, link, etc.) I already have a View for this, but how can assign this View to this dynamic url taxonomy page? I found the module http://drupal.org/project/tvi , but cant make it work.
It should be simpler to overwrite term pages with a view, there's already a pre-configured view for this : taxonomy_term (wich is disabled by default)

Drupal Views question

I want to display a different set of 2 or 3 images in a block on each page. So far, I have:
Added images to each page using CCK and filefield.
Removed the images from $content.
Created a view with node ID (Nid) as the argument, and added the field created with CCK, and added display type of Block.
When I try the Live Preview, it will display all the images for all pages in the block. When I enter the Node ID variable, it adds a where clause to the sql query and displays the correct images for that page.
How (where) do I set it up so that the view recognizes that it is on Node 3 and displays only the images for Node 3.
Thanks
John
"How (where) do I set it up so that the view recognizes that it is on Node 3 and displays only the images for Node 3." -- you can do this by clicking on the settings for the Nid argument in Views. Under Action to take if argument is not present: choose Provide Default Argument. In that, choose Node ID from URL
Position your block in the appropriate region (left sidebar, right sidebar etc). Make sure the visibility settings of the block are such that it only appears at paths that match node/*

Resources