Hallo,
ich gebe eine Struktur mit einem rekursiven Aufruf aus:
	
Jedes Item kann mehrere Childs haben. Das funktioniert wunderbar. 
Wie aber kann ich die Ausgabe über phplib Templates gestalten ? 
 
Ich habs schon mit mehreren Blöcken versucht, bekomms aber net hin.. Klappt irgendwie nicht..
Kann mir jemand das Beispiel umschreiben ?? Ich schaffs einfach net
Folgendes hab ich schon probiert:
	
Template topics.tpl
	
							
						
					ich gebe eine Struktur mit einem rekursiven Aufruf aus:
PHP Code:
	
	
print_topiclist();
    function print_topiclist($parent_id=0)
    {
        $temp_array = $this->topicarray[$parent_id];
        reset($temp_array);
        echo "<ol>\n";
        while(list($key,$val)=each($temp_array))
        {
            echo "<li><a href=\"#".$val['topic_id']."\">".$val['topic_title']."</a></li>\n";
            if(is_array($this->topicarray[$val['topic_id']])) $this->print_topiclist($val['topic_id']);
        }
        echo "</ol>\n";
    } 
Wie aber kann ich die Ausgabe über phplib Templates gestalten ?
 
 Ich habs schon mit mehreren Blöcken versucht, bekomms aber net hin.. Klappt irgendwie nicht..

Kann mir jemand das Beispiel umschreiben ?? Ich schaffs einfach net

Folgendes hab ich schon probiert:
PHP Code:
	
	
$tpl->set_file(array("topics" => "topics.tpl"));
$tpl->set_block("topics","topiclistitem","TOPICLISTITEM");
$tpl->set_block("topics","topiclist","TOPICLIST");
$topics = new topics(1);
$topics->print_topiclist(0);
$tpl->parse("OUT","topics");
$tpl->p("OUT");
[snipp]
    /**
     * @return void
     * @param parent_id = null int
     * @desc Gibt eine Liste der Topics (nur Fragen) aus...
     */
    function print_topiclist($parent_id=0)
    {
        global $tpl;
        $temp_array = $this->topicarray[$parent_id];
        reset($temp_array);
        
        $tpl->set_var(array("NEWLEVEL"=>"<ol>", "NEWLEVELEND"=>"</ol>"));
        while(list($key,$val)=each($temp_array))
        {
            $tpl->set_var(array("TOPIC_ID"=>$val['topic_id'],"TOPIC_TITLE"=>$val['topic_title']));
            $tpl->parse("TOPICLISTITEM","topiclistitem",true);
            #echo "<li><a href=\"#".$val['topic_id']."\">".$val['topic_title']."</a></li>\n";
            if(is_array($this->topicarray[$val['topic_id']])) {
                $this->print_topiclist($val['topic_id']);
            }
        }
        $tpl->parse("TOPICLIST","topiclist",true);
    } 
Code:
	
		<!-- BEGIN topiclist -->
		{NEWLEVEL}
		<!-- BEGIN topiclistitem -->
			<li><a href="{TOPIC_ID}">{TOPIC_TITLE}</a></li>
		<!-- END topiclistitem -->
		{NEWLEVELEND}
	<!-- END topiclist -->
 
          
Comment