1

I have a view created that show content based on the url: eg: domain.com/projects/[username]/[projectname], which shows a project of a specific user, that works well. Additionally, I want to show the related projects of this user on the sidebar, so I create a block view, using the Contextual filters and the default value.

because my url is projects/username ,By using the default value -> raw value from URL, so I set the path component as 2. but that doesn't work for me. eg: suppose my username is "abc".

in the preview, if the url path is "projects/abc", it doesn't show anything although the username is in the 2ed component of url path.

if the url path is "abc/*", it will show the related content, meaning as long as the username is in the first argument of the url path, it works.

I don't what happens, it seems that configuration of path component as 2 doesn't work. I am so puzzled , what happened ?

1
  • Welcome to Drupal Answers. Please clarify a few things by telling us all of the configuration settings for the contextual filter (including validation settings) and the other view settings such as whether fields or content is called, what filters are set, whether this is a page or block view, is there a path for the view? and any relationships defined.
    – Ashlar
    May 10, 2012 at 14:42

1 Answer 1

0

If your first contextual filter is your username filter then it will respond to the first argument passed in the preview textfield, no matter what default value you have specified. Your default value is for when an argument is not passed. So, entering "projects/abc" in the Preview with contextual filters box will pass 'projects' to your username filter, but passing a valid username as the first argument as in "abc/*" will work correctly.

It sounds like you've got it set up correctly to me. Have you tried deploying your block view on an actual page?

1
  • Thank you, andykisaragi, I get the problem solved. In fact, my configuration is right, the problem is the preview can't show correctly, but deploying the block view to the actual page works .
    – helxsz
    May 11, 2012 at 8:13

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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