pp wrote:

> Hi!
> 
> I got a little problem , but I don't get it even take it with midgard or
> just PHP.
> 
> I got topics with such like this:
> 
> <Form action="script1" method="get">  
>     <? if (!$action && ($t = mgd_list_topics($topic->id))) { ?>  
>    <p><? while ($t->fetch())  
>             printf('<li>  
>     <input  
>       type="checkbox"  
>      name="topic_list[]"  
>      value=" ' . $t->id . ' ">  
>     <a href="&(host.prefix);/%d.html">%s</a><br>%s', $t->id,  
>                    $t->name ? htmlentities($t->name) : ('topic #' .
> $t->id), "\n");   
>     ?>  
>     </p>  
>     <? } ?>  
>     <input type="submit">  
>     </form>  
> 
> 
> and get displayed articles with this:
> 
> <Form action="script2" method="get">   
>    <table width="70%" border="0" cellspacing="5" cellpading="5">   
>   <? 
>   for($i=0; $i<count($topic_list);$i++) { 
>      $article = mgd_list_topic_articles($topic_list[$i]); {?> 
>      <?  
>     while ($article->fetch())  
>     if ($article->title) { ?>  
>     <tr><td bgcolor="#e5e4b7"><p>&nbsp;&(article.title);</p></td>  
>     <td width="20%" bgcolor="#e5e4b7"
> align="right"><p><b>&nbsp;&(article.abstract);&nbsp;</b></p>  
>    </td> <td><input type="checkbox" name="article_list[]"   
>         value=" ' . $t->id . ' ">   

I guess you meant $article->id instead of $t->id.
Here you're listing article ids....

>     <?   } ?>  
>    <?   } ?>  
>    <?   } ?>  
>    </td></tr></table><br>   
>    <input type="submit">   
>    </form> 
>     
> everything works fine  , but now I want select few articles within these
> selected using this:
> 
> <table width="70%" border="0" cellspacing="5" cellpading="5">    
>   <?  
>  for($i=0; $i<count($article_list);$i++) {  
>    $article = mgd_list_topic_articles($article_list[$i]); {?>  

....and this function accepts a topic id as argument.

That's probably why it cannot get the right article.


>   <?   
>    while ($article->fetch()) 
>   if ($article->title) { ?>   
>     <tr><td bgcolor="#e5e4b7"><p>&nbsp;&(article.title);</p></td>   
>    <td width="20%" bgcolor="#e5e4b7"
> align="right"><p><b>&nbsp;&(article.abstract);&nbsp;</b></p>   
>   </td> <td><INPUT TYPE="CHECKBOX">  
>     <?   } ?>   
>     <?   } ?>   
>   <?   } ?>   
>   </td></tr></table><br>    
> 
> and get error:
>  
> Warning: $article is not an object in content on line 6
> 
> Fatal error: Member function used on a non-object in content on line 6
> 
> 
> code-init is of-course mostly standard for articles.
> Maybe I make a stupid mistake but these scripts seem to mostly work.
> 
> 
> Piotras
>  



-- 
Best Regards,
David Guerizec           Free Software Developer
Aurora R&D               [EMAIL PROTECTED]
Midgard core developer   http://www.midgard-project.org/


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

Reply via email to