Hi folks.

I have various content that I want to appear in search results but I'd rather that the content was displayed in a certain view page as opposed to the single, naked, lonely node display when the user clicks the search result. I'd like to be able to do this on a per-content-type basis.

I guess they way to do it is:

1) Setup a rule that triggers when 'Content is going to be viewed'.
2) Add condition to test for 'Content has type'.
3) Add further condition to test if the page to be viewed is NOT just a bunch of search results.
4) If (2) & (3) return true, redirect the user to my preferred URL.

The only bit I'm not sure how to do is the condition in step (3). I guess it would need to be a 'Check a truth value' or 'Execute custom PHP code' condition but I'm stuck as to what code I'd use.

As a last resort, I'd consider replacing step (3) for a condition to test if the page to be viewed is NOT just a teaser version of the node (because I'm not using teasers anywhere else on the site). However, I'd rather avoid this as it could possibly complicate things later if I decide to start using teasers elsewhere. Either way, I can't even get this solution to work as I'm struggling with the required PHP.

Any tips would be greatly appreciated :)

PS - In case you're wondering, I have tried just using the path_redirect module but it doesn't let you do redirects from one URL alias to another.

Comments

HFlame7’s picture

Component: Rules Core » Rules Engine

+1 Does anyone know how to do this?

dddbbb’s picture

I ended up using the Search by page module in the end:

http://drupal.org/project/search_by_page

This allowed me to tweak search functionality and search results in such a way that I no longer had to tackle the problem explained in this issue.

Hope that helps.

HFlame7’s picture

Thanks!

tr’s picture

Component: Rules Engine » Rules Core
Status: Active » Closed (outdated)