Re: contributed examples

From: Date: Sun, 13 May 2001 11:15:54 +0000
Subject: Re: contributed examples
References: 1  Groups: php.smarty.general 
Request: Send a blank email to php-smarty-general+get-752@lists.php.net to get a copy of this message
At 11:42 13/05/01 +0200, Alain Fontaine wrote:
Hello Luc, I agree with what you're saying about XML/XSLT. I am too using XML->PHP->Smarty and that works very well. How do you parse your XML with PHP? I'm using an XML class called xml.class.php from http://www.hansanderson.com/php/xml/ and that one works just perfectly fine for what I need it with!
Alain I use exactly the same class.. and its a real dream :-)) for example to display long text stored as XML files (more convenient than sore them in mySQL) et do : case 'documents': //------------------------------------------------------------------- $array_article_entete= array(); $array_article_corps= array(); for($i=0;$i<sizeof($xml['article']);$i++) {
                array_push ($array_article_entete,
                array('article_id'=>$xml['article'][$i]->attributes[0]["id"],
                'copyright'=>$xml['article'][$i]->copyright[0],
                'author_name'=>$xml['article_author'][$i]->name[0],
                'author_email'=>$xml['article_author'][$i]->email[0],
                'article_title'=>$xml['article'][$i]->title[0],
                'abstract'=>$xml['article'][$i]->abstract[0]));
                                }
for($i=0;$i<sizeof($xml['article_paragaph']);$i++) {
                array_push ($array_article_corps,
                array('paragaph_id'=>$xml['article_paragaph'][$i]->attributes[0]["id"], 
                'paragaph_title'=>$xml['article_paragaph'][$i]->title[0],
                'paragaph_chapo'=>$xml['article_paragaph'][$i]->chapo[0],
                'paragaph_text'=>$xml['article_paragaph'][$i]->text[0]));
} //-- //-- $tpl->assign('array_article_entete', $array_article_entete); $tpl->assign('array_article_corps', $array_article_corps); $tpl->assign('op','article'); break; then in *.tpl <table width="100%" border="0" align="center"> {section name=article_entete loop=$array_article_entete} <tr>
        <td>
        <h3>{$array_article_entete[article_entete].article_title}</h3>
        <div align="center">
        {$array_article_entete[article_entete].copyright}<br>
        <a href="mailto:{$array_article_entete[article_entete].author_email}">
        {$array_article_entete[article_entete].author_name}</a></div><br>
        {$array_article_entete[article_entete].abstract}
        </td>
</tr> {/section} {section name=article_corps loop=$array_article_corps} <tr>
        <td><b>{$array_article_corps[article_corps].paragaph_title}</b><br>
        {$array_article_corps[article_corps].paragaph_chapo}<br>
        {$array_article_corps[article_corps].paragaph_text}<br>
        </td>
</tr> {/section} </table> Luc

« previous php.smarty.general (#752) next »