Someone suggested I post some info on this, so here goes.
Navigation Block records have a Show When field on them. That field can be used to control when the nav block appears. Leave it blank, and it appears on all pages. If you enter a PHP statement that can evaluate to true or false, the nav block only appears when that statement is true. So, if you entered this in that field:
5 + 5 == 10
The nav block will always appear. If you enter this:
5 + 5 == 2
It will never appear.
If you have SEO URLs enabled, suppose you have a page setup in Squirrelcart (via these instructions), and the URL to that page is something like this:
http://www.example.com/content/my-dog-has-fleas
If you have a navigation block that you want ONLY to appear on that page, put this in the Show When field:
Now, suppose you have a lot of pages all about dogs on your site and you want the nav block to appear only on those pages. URLs are like this:PHP Code:$GLOBALS['path_pieces'][1] == 'my-dog-has-fleas'
http://www.example.com/content/my-dog-has-fleas
http://www.example.com/content/your-dog-has-fleas
http://www.example.com/content/dogs-are-wonderful
For the above URLs, you could use something like this in the Show When field instead:
PHP Code:preg_match('/dog/',$GLOBALS['path_pieces'][1])
The first parameter passed to the preg_match function is a string containing a regular expression. For more information on how those work, search Google for "regular expressions" and you'll find lots of info.




Reply With Quote