I am trying to create a page view that will display content by Content:Title which is part of the node's URL.

I have 3 content-types: Movies, Books, and TV Shows.

Each content type has a path alias matching the [node:content-type:machine-name]/[node:title]/[current-date:custom:Ymd] pattern.

I successfully created a view called movies with a filter on Movies that displays all the nodes with www.example.com/movies/ in the URL. If I click on a node in the Movies view, it displays the content using the node.tpl.php template file.

I added a contextual filter (Content: Title) using Scott Edmonds suggestion.

Contextual Filter for: Content: Title ). When filter is not in URL -> Provide Default Value -> Raw Value from URL -> Path Component=2. Use Path Alias=Checked. Then, When Filter Value is In URL: Specify Validation Criteria= "PHP Code" with the following PHP code: $handler->argument = str_replace("-"," ",$argument); return true; That did the trick. the PHP code converts the dashes to spaces so it can be evaluated correctly.

The result is that when I click on the "Star Trek is Great" post link I am taken to the correct URL, www.example.com/movies/star-trek-great/20130702, but node.tpl.php is the template used instead of views-view--movies.tpl.php.

When I copy the title and paste it into the url, as "www.example.com/movies/Star Trek is Great/20130712" the views template page comes us.

Some where along the way I am missing something. Any help out there?

FYI - I also have simply set the contextual filter on Content:Title with Display all results for the specified field Checked "Override title" and added %1 as the first argument Seleced "lowercase" for the Case PATH Selected "transform spaces to dashes in url"

But nothing worked :(

1 Answer 1


The issue is the following:

When you go to www.example.com/movies/star-trek-great/20130702 Drupal sees that this is a path alias to node/#, and it displays that node. It won't use Views at all.

When you go to www.example.com/movies/Star Trek is Great/20130712, this does not map to any URL, but rather to the View sitting at www.example.com/movies with an contextual filter of Star Trek is Great (and 20130712 most probably).

You may have some other issues to work out as well:

Pathauto is taking out the is (and other small words by default) so there will be a bit of a hard time mapping star-trek-great to Star Trek is Great.

Also, what happens if you have a title of Star Trek is Great!!! that maps to star-trek-great as well?

Your Answer

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

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