0

It's difficult to explain but i'll try to do my best.

I have a basic views (Page) with all my fields displaying. My purpose is to take some of this fields to display them in a block(on the left sidebar)

This fields i want to display in a block are:

  • Flag: bookmarks
  • AddThis: Toolbox
  • Private msg (send message to the author)

I follow all the screemcast "Taming the beast" (from nodeone.se) especially part 24 when Johan Falk explain how to make a block with a related content to a page (without using page manager)

When i go to my article my url is like that: /fiches-produits-services/100 (100=>[nid])

I follow this step when i create my block:

  • Add my fields etc.
  • Add contextual filter : content: nid
  • click on it, go to WHEN THE FILTER VALUE IS NOT AVAILABLE
  • Click on Provide default value
  • Select Content ID from url

But after that nothing, the block isn't here. When i click on Display all results for the specified field on the same section, the block appears but with all the flags, the privatemsg and socials icons from all my article.

It's not the bahavior i want, i would like to have just the flag related to the article, just the link from private messages related to the article etc.

I don't know if i missed something. In the screemcast he did that with content(article) related with another content (basic page), maybe we can't do that with flag, addThis or privatemsg because it's not really a content (But i don't really know i'm new).

So if someone can help me to understand that, i'll be very grateful.

0

I found a way this week to get the good behavior.

i understood my mistake! My url was like that www.example.com/my-product/2 (made with pathauto)

When i selected content ID from URL my block was empty because he couldn't retrieve the good argument from the url (because my node id was in second position) But when i go to www.example.com/node/2 it works fine

To resolve my problem i select raw value from URL instead of content ID from URL (because with that option we can select which argument we want to retrieve --that was the second for me because of my custom url)

In summary i follow this step :

  • Add contextual filter : content: nid
  • click on it, go to WHEN THE FILTER VALUE IS NOT AVAILABLE
  • Click on Provide default value
  • Select raw value from URL
  • Select the argument you want to retrieve from the url (path component)
  • I check Specify validation criteria
  • Validator : content
  • Filter value format : node id
  • Action to take if filter value does not validate : no result

It was a stupid mistake :) but i learn some stuff :)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.