> Hey there!
Greetings
> I have come up with my question for the midweek......but I have no list to
> ask so I thought I would see if you had a quick answer...if not I can wait
> until the list comes back
>
Well, I received this mail, so maybe the list is back ?
> I am trying figure out how to do this: I have a parent topic with child
> topics each with articles...I want to be able to to list the topics but
> also the child articles after their topic......
>
> topic1
> (topic description...maybe)
> topic1article1
> topic1article2
> topic1article3
> topic1article4
>
> topic2
> topic2article1
> topic2article2
> topic2article3
>
>
if($topic=mgd_list_topics($parent_topic_id))
while($topic->fetch())
{
echo $topic->name."<br>";
if($article=mgd_list_topic_articles($topic->id))
while($article->fetch())
{
echo $topic->name." - ".$article->name;
}
echo "<br>";
}
That's it !
If you want to display recursively an entire topic tree, use a recursive
function which display the topic->name and all its articles, and that call
itself with the subtopic->id.
> .....I have been trying to think of loops with child loops and things like
> that but since mgd_list_topics seems to return an array I am not sure
how
> to break into that structure....
mgd_list_topics doesn't return an array, but an object with the fetch()
function embedded into it. That function allows you to get all the records
one by one in a while loop.
> it definately doesn't seem that a simple
> call is going to do it, but it also seems that there are places in the
> admin site where there are similar ideas....like the little drop menus in
> the topic admin....
> I thought about getting the number of the first child topic, listing it,
> getting the child articles and then adding one to the number of the gotten
> article....but that supposes that the topics are sequentially numbered, if
> someone adds a topic later they won't be.....
the database ids ARE NOT sequencial, so the only way is to use the fetch()
function.
> kp
regards,
[EMAIL PROTECTED]
http://webmaster.brainshaver.net/
--
This is The Midgard Project's mailing list. For more information,
please visit the project's web site at http://www.midgard-project.org
To unsubscribe the list, send an empty email message to address
[EMAIL PROTECTED]