taxonomy_menu/VID/TID/TID ..how to get the TID parent en child extracted
Summit - September 19, 2008 - 22:54
| Project: | Taxonomy Menu |
| Version: | 6.x-1.x-dev |
| Component: | Code |
| Category: | support request |
| Priority: | normal |
| Assigned: | Unassigned |
| Status: | closed |
Jump to:
Description
Hi,
I have the following url's
www.wintersport-accommodaties.nl/taxonomy_menu/4/10 and
www.wintersport-accommodaties.nl/taxonomy_menu/4/10/15 (term 15 is a child of term 10)
How can I get the TID from these urls?
So 10 from the url www.wintersport-accommodaties.nl/taxonomy_menu/4/10
And 15 from the url www.wintersport-accommodaties.nl/taxonomy_menu/4/10/15
Something with strlen and strrpos , but I can not figure out how?
Thanks a lot in advance for your assistence!
greetings,
Martijn

#1
you can use
<?php$tid = array_pop(explode("/",$_GET['q']));
?>
#2
Hi,
Thanks for your assistence!
But I got taxonomy_menu back from this php_code, and not the TID as asked.
Looking further http://drupal.org/node/180589#comment-277452 explains that $_GET['q'] gives the taxonomy_menu and not the TID (the rear end of both urls.\
Anyone else suggestions please?
Thanks a lot in advance.
greetings,
Martijn
#3
$_GET['q'] gives you the whole drupal path
explode divides it into pieces
array_pop gets the last piece
sounds just like what you need
#4
Hi,
I succeeded in doing this! i twas not the url I needed to strip, but the $path. thanks for supporting!
greetings,
Martijn
#5
Automatically closed -- issue fixed for two weeks with no activity.