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

Comments

derhasi’s picture

Status: Active » Fixed

you can use
$tid = array_pop(explode("/",$_GET['q']));

summit’s picture

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

Afief’s picture

$_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

summit’s picture

Hi,
I succeeded in doing this! i twas not the url I needed to strip, but the $path. thanks for supporting!

greetings,
Martijn

Anonymous’s picture

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for two weeks with no activity.