RE: [PEAR] Real world usage of IT [template] class?
| From: | Dietrich Ayala | Date: | Thu, 04 Apr 2002 18:10:02 +0000 |
| Subject: | RE: [PEAR] Real world usage of IT [template] class? | ||
| References: | 1 | Groups: | php.pear.general |
| Request: | Send a blank email to pear-general+get-1090@lists.php.net to get a copy of this message | ||
If you use ITX (which extends IT), you have access to a method addBlockFile(), which does what you
need.
api docs are here:
http://www.ulf-wendel.de/docs/itx/index2.html
btw, I use IT(X) for all of my client's projects (albeit a modified version). It's my fav
template solution, in spite of all the
crap it gets from people on this list. Use the tool that's right for the job, eh?
Dietrich
> -----Original Message-----
> From: derek fong [mailto:pear@subtitled.com]
> Sent: Thursday, April 04, 2002 6:52 AM
> To: derek fong; PEAR General
> Subject: Re: [PEAR] Real world usage of IT [template] class?
>
>
> Hmmm... so should I take it that nobody really uses PEAR's IT class? Too
> bad, it looks like it could be useful... :(
>
> Anyway, if anyone does use it, maybe you can help me out with this one.
> What is the proper way to include a file into an existing template which has
> its own placeholders? I think I'm supposed to use the get_file() method,
> but I can never seem to parse the placeholders in the file that's included.
>
> $tpl = new IntegratedTemplate("./");
> $tpl->loadTemplatefile("template.tmpl", false, false);
>
> // parse DMZ helper on right side of the page
> $dmz_content = $tpl->getFile("template2.tmpl");
> $tpl->setVariable("DMZ", $dmz_content);
>
> $tpl->setCurrentBlock("dmz");
> $tpl->setVariable("DMZ_LIST", "- <a
> href=\"test.php\">Name</a>
> (#)<br>");
> $tpl->parseCurrentBlock("dmz");
>
> $tpl->setCurrentBlock("main_body");
> $tpl->setVariable("USERNAME", "Derek Fong");
> $tpl->setCurrentBlock("main_body");
> ...
>
> What am I missing?
>
> -f
>
>
>
> On 03.30.2002 10:42 am, "derek fong" <pear@subtitled.com> wrote:
>
> > Hi,
> >
> > I am considering using the IT class for the first time in an upcoming
> > project. Can anyone give me any pointers on how to most effectively set
> > everything up? Any caveats?
> >
> > I have followed the docs on http://pear.php.net/ and while
> > it seems pretty
> > straightforward, it would be nice to see a real-world example of how
> > everything comes together.
> >
> > Finally, as the first of what will probably become many questions, what is
> > the best way of setting up form logic so that on first view, all the text on
> > the page is black, but if there are any errors on the submission, the same
> > page is returned, but with the relevant fields in red text? The only way I
> > can see how to do that would be to actually embed the style in the code that
> > replaces the placeholder. Am I correct? Is it considered "acceptable" to
> > embed minimal display elements in the code (such as <span class=... or <font
> > color=...) even though that's supposed to be all contained within the
> > template file?
> >
> > Thanks!
> >
> > -f
> >
>
>
> --
> PEAR General Mailing List (http://pear.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>