« Digital Curation Bibliography | Main | Update D7 Core and Contrib Modules »

June 29, 2012

Trigger Rules Action based on URL

In Drupal 6, I used the Path Rules module but it appears this is not going to be ported because the functionality exists in the base Rules module.

How to do this in D7 Rules?

Events to use:

1) If the page to be viewed is a Node then you can use "Content is Viewed".

2) If the page to be viewed is not a node but is a view or panels page then use "Drupal is initializing". Note that this fires every time someone looks at a page and probably engenders a performance hit. In Rules Bonus Pack, there is also a possibility to use Page manager's custom pages as Rules triggers.


Using the Text Comparison is the way to go. For example I used
site:current-page:path under Data Selector and data/\d+/summary under the Matching Text with the Comparison Operation set to Regular Expression. This allows for use of a wildcard. That regex is equivalent to data/*/summary where * is an NID argument.
If your URL is dynamically constructed with an argument, you

Posted by kkwaiser at June 29, 2012 09:09 AM


Login to leave a comment. Create a new account.