By mrigank on
Hi all,
I am trying to display a block based on URL hierarchy depth.
My URL hierarchy is like 1/2/3/4/5/6
I have a block which I want to show only for 1/2/3 and 1/2/3/*
but not for 1/2/3/*/* or 1/2/3/*/*/*.
I tried the following using the option
Show on only the listed pages
1/2/3
1/2/3/*
This does not work. It shows for all 4 types, 1/2/3, 1/2/3/*, 1/2/3/*/* and 1/2/3/*/*/*.
Show on only the listed pages
1/2/3
1/2/3/*/
This also does not work. This shows only for 1/2/3 only.
Can you please help me out?
Thanks,
Mrigank.
Comments
I would use the PHP option
I would use the PHP option and the code
I tried this but the problem
I tried this but the problem is that these are taxonomy pages with Path Auto used to give meaningful URLs.
Using the arg() API returns the value from the URL type taxonomy\term\*
To put the problem in a different way, I want to display the block only if the URL contains a given taxonomy term or its children.
The below code works for a given term id, but does not show the block for the children
One option is to hard code all children ids or use the API to get children for a tid. I am trying that now.
<?phpif (arg(0) != "" ||
Here is how you can get terms in the mix as well.
http://drupal.org/node/69076
Finally Worked
Hi all,
Thanks for the help.
This code snippet finally worked
Thanks,
Mrigank.
You would have to use php for
nm - nevets beat me to it.