Hi Miles,

On Sun, 22 Jul 2001, Miles Scruggs wrote:
> <?php
>  $topic = mgd_get_topic_by_name($name);
>  $topic_id = $topic->id;
> ?> 
> 
> Now why doesn't the function mgd_get_topic_by_name() work?  as far as I can 
> tell it isn't returning anything.  I know that I'm passing it the correct 
> name, but I can't get the ID. 

I'm surprised it doesn't return an error. mgd_get_XXX_by_name() functions
all expect the id of the parent object and a name. This is because topics
can have the same name as long as they don't have the same parent topic.

try something like:
<?php
  $parent_id = 0;
  $topic = mgd_get_topic_by_name($parent_id, $name);
  $topic_id = $topic->id;
?>

this way you would get root-topics by their name. If the topic are not
root-topics, you would have to get the parent_id using guid methods, or a
recursive get_by_name from the top down, since you use a staging
environment. Hardcoding the id would break in propagation to the live
server.

-- 
'The joy of my life is in Zion - Lauryn Hill'
Armand A. Verstappen * <[EMAIL PROTECTED]> *


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to