Re: pear template revoke problem

From: Date: Tue, 29 Jun 2010 08:55:49 +0000
Subject: Re: pear template revoke problem
References: 1  Groups: php.db 
Request: Send a blank email to php-db+get-47234@lists.php.net to get a copy of this message
The problem resolved because the following line: $tpl = new HTML_Template_IT("./template"); changed to : $tpl = new HTML_Template_IT("."); the .php works fine. All you best ------------------------ What we are struggling for ? The life or the life ? On Tue, Jun 29, 2010 at 2:55 PM, win.a <win.acc@gmail.com> wrote: > Hello,the phpers.i'm recently learn to use the pear HTML_Template_IT, > The following is my test template test.tpl,the source code is : > <html> > <table> > <!-- BEGIN CELL --> >  <tr> >   <td> >    {DATA} >   </td> > <!-- END CELL --> >  </tr> >  </table> > </html> > > And my php revoke source code is : >  <?php >        require_once "HTML/Template/IT.php"; > >        $data = array("Peter","Quagmire","Joe"); > >        $tpl = new HTML_Template_IT("./template"); > >        if (!$tpl) { >                echo "object inital failed!"; >                echo "<br />"; >        } >        else >                print "Object initial succeed!<br />"; > >        $tpl->loadTemplatefile("test.tpl", true, true)  ; > >        if (!$tpl) { >                echo "template load failed!"; >                echo "<br />"; >        } >        else >                print "template load succeed!<br />"; > >        foreach ($data as $sd  ){ >                //echo $sd; >                //echo "<br />"; >                $tpl->setCurrentBlock("CELL"); >                $tpl->setVariable("DATA", $sd); >                $tpl->parseCurrentBlock("CELL"); >        } >        $tpl->show(); > ?> > > When it runs it just result this : > > Object initial succeed! > template load succeed! > > i don't why the array data are not displayed?Any comments are appreciated ! > > All you best > ------------------------ > What we are struggling for ? > The life or the life ? >

« previous php.db (#47234) next »