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

derhasi - September 20, 2008 - 09:15
Status:active» fixed

you can use

<?php
$tid
= array_pop(explode("/",$_GET['q']));
?>

#2

Summit - September 20, 2008 - 10:25

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

Afief - September 21, 2008 - 12:00

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

Summit - September 21, 2008 - 15:28

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

greetings,
Martijn

#5

Anonymous (not verified) - October 5, 2008 - 15:32
Status:fixed» closed

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

 
 

Drupal is a registered trademark of Dries Buytaert.