i have a view block - that shows 3 last images of my content type sidebar image(block is displayed on every page). Content type has two fields - image and path - url path alias, for example 'content/example'.

By default i need to show this 3 images that has been created without path(its not mandatory field) - i did this its works fine, but now when user create new node of sidebar image with path alias 'content/example' - i need to show this picture in my view instead of one of the three default on this path.

The path can be - either view or node or taxonomy term.

I tried to create contextual filter with path field and provide default value, but kinda stuck here because its a path alias.

Any suggestions?

What i think of is to parse URL get the path, and then query to DB - and check is my path is equal to image path so i can change the query of view.

  • What is the reason for the path field? What does it accomplish? – Triskelion Feb 27 '13 at 16:46
  • path its just a url without domain name - for example full url http://exaple.com/content/test and the path is content/testpath is needed in order to display the desired image on the right page inside this view, I probably need to parse url in parts and make changes in preprocess_views – Petro Popelyshko Feb 27 '13 at 16:52
  • Not sure if it would work, but you might look at a contextual filter, if I understand your intent. If the filter does work, though, it will only display those images which are a match. If there is no match, you can configure a default behaviour. Views is great for standard use cases and prototyping, but you might have to look at a custom block. – Triskelion Feb 27 '13 at 18:25

Your Answer

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

Browse other questions tagged or ask your own question.