Re: Re: Question about template systems

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, 2009-03-04 at 12:15 -0700, Nathan Nobbe wrote:
> On Wed, Mar 4, 2009 at 11:51 AM, Robert Cummings <robert@xxxxxxxxxxxxx>wrote:
> 
> > On Wed, 2009-03-04 at 12:46 -0600, Shawn McKenzie wrote:
> > > Robert Cummings wrote:
> > > > On Wed, 2009-03-04 at 10:55 -0600, Shawn McKenzie wrote:
> > > >> Robert Cummings wrote:
> > > >>> On Tue, 2009-03-03 at 21:18 -0600, Shawn McKenzie wrote:
> > > >>>> Matthew Croud wrote:
> > > >>>>> Hello,
> > > >>>>>
> > > >>>>> First post here, I'm in the process of learning PHP , I'm digesting
> > a
> > > >>>>> few books as we speak.
> > > >>>>> I'm working on a content heavy website that provides a lot of
> > > >>>>> information, a template system would be great and so i've been
> > looking
> > > >>>>> at ways to create dynamic data with a static navigation system.
> > > >>>>>
> > > >>>>> So far, using the require_once(); function seems to fit the bill in
> > > >>>>> order to bring in the same header html file on each page.
> > > >>>>> I've also looked at Smartys template system.
> > > >>>>>
> > > >>>>> I wondered how you folk would go about creating a template system ?
> > > >>>>>
> > > >>>>> My second question might be me jumping the gun here, I haven't come
> > > >>>>> across this part in my book but i'll ask about it anyway.  I often
> > see
> > > >>>>> websites that have a dynamic body and static header, and their web
> > > >>>>> addresses end like this: "index.php?id=445" where 445 i presume is
> > some my
> > > >>>>> file reference.
> > > >>>>> What is this called ?  It seems like the system i'm after but it
> > doesn't
> > > >>>>> appear in my book,  If anyone could let me know what this page id
> > > >>>>> subject is called i can do some research on the subject.
> > > >>>>>
> > > >>>>> Thanks for any help you can provide :)
> > > >>>>>
> > > >>>>> Matt.
> > > >>>>>
> > > >>>> I have written a popular theme/template system for some CMS systems.
> >  In
> > > >>>> my opinion, templating is only needed for those that are totally
> > > >>>> ignorant of the concept of programming languages in general.
> > > >>> I'm not sure... but I'm pretty sur eyou just called me ignorant.
> > Blanket
> > > >>> statements like that one above are themselves ignorant.
> > > >>>
> > > >>> Cheers,
> > > >>> Rob.
> > > >> Well then you're ignorant because I didn't call you ignorant!  Didn't
> > > >> you write your own template system?
> > > >>
> > > >> Seriously though, I should have worded that differently.  I guess the
> > > >> second paragraph was more what I was after.  But to clarify the first
> > > >> paragraph, I would suspect if they are anything like me, many of those
> > > >> that know and use PHP prefer to do control type things in PHP (loops,
> > > >> ifs, includes, etc.).  I know I do.  I like templating in that I use a
> > > >> template (HTML file) and add echos, or use simple templating logic so
> > > >> that {somevar} echoes $somevar, but why replicate what PHP can do with
> > a
> > > >> separate language?
> > > >
> > > > To punt what is repeated over and over during runtime to a single
> > > > compilation phase when building the template target. To simplify the
> > use
> > > > of parameters so that they can be used in arbitrary order with default
> > > > values. To allow for the encapsulation of complex content in tag format
> > > > that benefits from building at compile time and from being encapsulated
> > > > in custom tags that integrate well with the rest of the HTML body. To
> > > > remove the necessaity of constantly moving in and out of PHP tags. To
> > > > speed up a site. To speed up development. To make easier to use for
> > > > non-developers. To integrate standards compliance checks into the build
> > > > phase. To do sooooooooooooooo many things that are just inconvenient
> > and
> > > > tedious using intermingled PHP code with fixed parameters order (or
> > > > alternatively a big fugly array).
> > > >
> > > > Cheers,
> > > > Rob.
> > >
> > > Is that it?
> >
> > No... I could have gone on :)
> 
> 
> a bit ot, but id like to ask about TemplateJinn, Rob.  do you have to run
> the compile pass, or can it fall back to runtime content inclusion?  and no,
> ive not yet finished, RTFM :)

You can manually run the compile pass (one or more pages or entire
site). Or if enabled via configuration it can automatically detect page
dependency changes and recompile as necessary (great for development
since reloading in browser causes auto recompile). On live servers I
disable the auto compile option usually. The templates allow embedding
PHP code if you so wish, so you could embed run-time includes if you
wanted. Or you could create a tag that performs a run-time include...
I've used both methods for different projects. Legacy code or non-native
systems sometimes warrant chunking... so can compile content chunks that
benefit from custom tags but can themselves be included at runtime via
traditional include philosophies (header.php, footer.php, etc). I've
done this for generating custom MediaWiki/WordPress layouts. It's very
flexible... you can pretty much do what you want while benefitting from
custom tag engine (you're not limited to tags btw, it provides a generic
pre/post processing system that allows other stuff (I usually remove
unnecessary whitespace at a post process stage and for some sites fire
off a check on the W3C XHTML validator).

> also, morbidly curious, have you looked at blitz; thoughts ?

I hadn't even heard of it until the other day when someone suggested it.

Cheers,
Rob.
-- 
http://www.interjinn.com
Application and Templating Framework for PHP


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux