Hi!

Piotr Pokora wrote:
> I changed this e-mail topic ;))
> I just wanted to back to my old problem with history and root page.
> In admin demo site You have table with Location for any topics in
> specific topics tree. I just wanted to use these functions for may root
> page and all topics. But I don't know how to use it on root page. I
> thinj I must use it in some of my layout  pages (table in this case).
> How may I create sth like code-init for static page? ( I guess I can
> not )
> And how can I use these functions in any page element in Laoyut
> administration? ( I guess I can not).
> 
> I tried with this in table:
> <?
> 
>   function twalk($id) {
>         if ($id && !mgd_is_in_topic_tree(12, $id)) $id = 0;
>       if (!$id || !($t = mgd_get_topic($id))) return;
>       twalk($t->up);
>       printf(' / <a href="%d.html">%s</a> ', $t->id, htmlentities($t-
> >name));
>     }
>     if ($topic) { twalk($topic->up); ?> / &(topic.name); <? } else echo
> 'top level topic'; ?>
> 
> But it doesn't work when I want to see any article. So I wanted to use:
> 
> if ($topic) { twalk($topic->up); ?> / &(topic.name); <? } else
> twalk($topic)
> 
> But it doesn't work either.
> 
> Any hints or something like this???
Yes. The problem with code above is that you are trying to use it to
generate links to articles but it generates links for topics. For
articles you need something like this but with mgd_list_topic_articles()
instead.

The "problem" with static page is solveable easily. Remeber: page marked
as "active" automagically converts path after its name to parameters in
$argv[] array, while "static" page doesn't do this. Simple solution is
to pass object (topic|article) ID as query string, for example:
    printf(' / <a href="%s?topic_id=%d">%s</a> ', $midgard->uri, $t->id,
htmlentities($t->name));
Then all links will have form 'foo/?topic_id=bar' where 'foo' is page
name and 'bar' is ID of topic. Request for such link will bring you
$topic_id variable defined and initialized to value of topic's ID.

--
Alexander Bokovoy
"Open Channel D..."
-- Napoleon Solo, The Man From U.N.C.L.E.

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

Reply via email to