No code-init, I am waiting to get it all working in one element.
I do not believe this addresses my problem though.  
For each page visited, I need to display the code for the topic which is named same as 
the page.
I dont want to pass any variables to display the code field, subtopics or articles 
withing this topic.
And in general I want to access $topic->... in php code for other random applications 
like changing a navbar depenging on current page visited.

Or perhaps I misunderstand your suggestion.

Robert Murray

* Ken Pooley <[EMAIL PROTECTED]> [000809 16:43]:
> Is there a code-init page element?....from one of my pages...
> 
> <?
> if ($argc == 1) $id = $argv[0];
> if ($id && !mgd_is_article_in_topic_tree(240, $id)) $id = 0;
> if ($id) $article = mgd_get_article($id);
> if ($id) $topic = mgd_get_topic($id);
> if ($article) $author  = mgd_get_person($article->author);
> ?>
> 
> kp
> 
> -----Original Message-----
> From: [EMAIL PROTECTED] [SMTP:[EMAIL PROTECTED]]
> Sent: Wednesday, August 09, 2000 3:33 PM
> To:   [EMAIL PROTECTED]
> Subject:      Re: [midgard] variable "... is not an object ..." error problem
> 
> * Ken Pooley <[EMAIL PROTECTED]> [000809 16:20]:
> > What if you....
> > 
> >  <? $topicnum = $topic->id; ?>
> >       ?><DIV 
> > align="center"><P>&(topic.code:h);</P></DIV><br><br>&(topic.id);<?
> >       $article = mgd_list_topic_articles ($topicnum);
> 
> I tries this and most other simple permutations all with same result.
> 
> Output:
> Warning: $topic is not an object in dynamiccontent on line 25
> 
> 1: <? 
> 2: /* show this topic's code and list all articles or show all of one requested*/ 
> 3:   $page=mgd_get_page($midgard->page); 
> 4:   $topic=mgd_get_topic_by_name("0", $page->name); 
> 5:   ?><h1>&(page.title);</h1><? 
> 6:  
> 7:   if (isset($topic)) { 
> 8:  
> 9:     /* show requested article */     
> 10:     if (isset($id)) { 
> 11:       /* Get requested article... */ 
> 12:       $article = mgd_get_article($id); 
> 13:       if ($article->url) { ?> 
> 14:         <a href="&(article.url);"><h1>&(article.title);</h1></a> 
> 15:       <? } else {?> 
> 16:         <h1>&(article.title);</h1> 
> 17:       <? } ?> 
> 18:   
> 19:       <h3>&(article.abstract);</h3> 
> 20:       <p>&(article.content:f);</p> <? 
> 21:  
> 22:     /* Show topic code and list articles */ 
> 23:     } else { 
> 24:       ?><DIV align="center"><P>&(topic.code:h);</P></DIV><br><br>&(topic.id);<? 
> 25:       $topicNum = $topic->id; 
> 26:       $article = mgd_list_topic_articles($topicNum);  
> 27:       if ($article) { 
> 28:         ?><ul><?  
> 29:         while ($article->fetch()) { 
> 30:           ?><li><i><a 
>href="&(midgard.uri);?id=&(article.id);">&(article.title);</a></i><? 
> 31:           /* Show abstract (if there is any abstract entered). */ 
> 32:           if ($article->abstract) { ?> 
> 33:             <br>&(article.abstract:f);<? 
> 34:           } ?> 
> 35:           </li><? 
> 36:         } ?></ul><? 
> 37:       } 
> 38:     } 
> 39:   } 
> 40: ?>
> 
> Robert Murray
> 
> 
> > 
> > kp
> > 
> > 
> > 
> > 
> > -----Original Message-----
> > From:       [EMAIL PROTECTED] [SMTP:[EMAIL PROTECTED]]
> > Sent:       Wednesday, August 09, 2000 2:57 PM
> > To: [EMAIL PROTECTED]
> > Subject:    [midgard] variable "... is not an object ..." error problem
> > 
> > Hi all,
> > 
> > Working towards mapping all topic structure to pages I am comletely stumped 
> > by this output error:
> > 
> > Warning: $topic is not an object in dynamiccontent on line 25
> > 
> > dynamiccontent is a style element as included below.  I use the 
> > mgd_get_..._by_name functions which I have preincluded.
> > 
> > When I output $topic fields using the &(topic.code); syntax, the contents 
> > of the code field are displayed fine.  However whener I try to access 
> > $topic fields within php code I get the error above.  I also experience the 
> > same problems when using the $midgard object to access uri.  I seem to 
> > access these vars same as in examples but to no avail.
> > 
> > particluar offending code(excerpted from below):
> >       ?><DIV 
> > align="center"><P>&(topic.code:h);</P></DIV><br><br>&(topic.id);<?
> >       $article = mgd_list_topic_articles($topic->id);
> > 
> > 
> > 
> > Much thanks for any help,
> > Robert Murray
> > 
> > dynamiccontent element:
> > 
> > <?
> > /* show this topic's code and list all articles or show all of one article 
> > requested*/
> >   $page=mgd_get_page($midgard->page);
> >   $topic=mgd_get_topic_by_name("0", $page->name);
> >   ?><h1>&(page.title);</h1><?
> > 
> >   if (isset($topic)) {
> > 
> >     /* show requested article */
> >     if (isset($id)) {
> >       /* Get requested article... */
> >       $article = mgd_get_article($id);
> >       if ($article->url) { ?>
> >         <a href="&(article.url);"><h1>&(article.title);</h1></a>
> >       <? } else {?>
> >         <h1>&(article.title);</h1>
> >       <? } ?>
> > 
> >       <h3>&(article.abstract);</h3>
> >       <p>&(article.content:f);</p> <?
> > 
> >     /* Show topic code and list articles */
> >     } else {
> >       ?><DIV 
> > align="center"><P>&(topic.code:h);</P></DIV><br><br>&(topic.id);<?
> >       $article = mgd_list_topic_articles($topic->id);
> >       if ($article) {
> >         ?><ul><?
> >         while ($article->fetch()) {
> >           ?><li><i><a 
> > href="&(midgard.uri);?id=&(article.id);">&(article.title);</a></i><?
> >           /* Show abstract (if there is any abstract entered). */
> >           if ($article->abstract) { ?>
> >             <br>&(article.abstract:f);<?
> >           } ?>
> >           </li><?
> >         } ?></ul><?
> >       }
> >     }
> >   }
> > ?>
> > 
> > --
> > 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]
> > 
> > 
> > --
> > 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]
> > 
> > 
> 
> --
> 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]
> 
> 
> --
> 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]
> 
> 

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