Re: Templating ... a simple guide

All style (template, theme and imageset) related questions for the new release; advice, feedback here please.
User avatar
GPHemsley
Registered User
Posts: 1617
Joined: Fri Apr 18, 2003 4:01 am
Location: Long Beach, NY
Contact:

Re: Templating ... a simple guide

Post by GPHemsley »

You said that you don't need an ELSEIF and that you can just do ELSE if you want, but is it possible to do ELSEIF, but not ELSE, like PHP does?

{ Posted as a new topic because posting to Stickies are not currently allowed :? }
User avatar
psoTFX
Registered User
Posts: 1984
Joined: Tue Jul 03, 2001 8:50 pm
Contact:

Re: Templating ... a simple guide

Post by psoTFX »

Obviously.
User avatar
haravikk
Registered User
Posts: 292
Joined: Sun Apr 20, 2003 5:05 pm
Contact:

Re: Templating ... a simple guide

Post by haravikk »

How efficient is this new system? Because it seems like phpBB would have to convert the template if statements into PHP, then run them adding in an extra step. Though I guess that's one of the things which is cached?
Images in sigs! please.
User avatar
dhn
Registered User
Posts: 1518
Joined: Wed Jul 04, 2001 8:10 am
Location: Around the corner
Contact:

Re: Templating ... a simple guide

Post by dhn »

haravikk wrote:How efficient is this new system? Because it seems like phpBB would have to convert the template if statements into PHP, then run them adding in an extra step. Though I guess that's one of the things which is cached?
The templates are cached in full php ready mode. The rough templates will only get touched and "recompiled" once when you change something in them.
Image
Roberdin
Registered User
Posts: 1546
Joined: Wed Apr 09, 2003 8:44 pm
Location: London, United Kingdom

Re: Templating ... a simple guide

Post by Roberdin »

Excuse me, Brief Overview!? How long is the full overview??

Anyway, looks great ( :D ), let me be the eight-hundred-and-ninety-second person to congratulate you on your amazing work ( ;) ). I really can't wait to get started, but I'm gonna wait for a feature frozen release first.
Rob
User avatar
psoTFX
Registered User
Posts: 1984
Joined: Tue Jul 03, 2001 8:50 pm
Contact:

Re: Templating ... a simple guide

Post by psoTFX »

I think it's probably "safe" to start work on some templates. Obviously some vars may change here and there ... but it will give you some experience of working with 2.2.x and possibility give myself some feedback on issues which may arise.
Darkshines
Registered User
Posts: 40
Joined: Thu Jan 24, 2002 7:14 pm
Location: Leyland, Lancashire

Re: Templating ... a simple guide

Post by Darkshines »

So, what about included files? phpBB must keep a record of what templates are included in what other templates, otherwise, when you change a template that had been included in another template, the other template wouldn't change.

The viewforum template, for example, must include overall_header, overall_footer and the forum jump box, and could feasibly include any number of other templates. when you modify one of these templates, this template must have to be checked on every page view of viewforum (although I suppose if this process was too intense you could make it happen only, say, once every four or five seconds at the most), and this would require a record somewhere of every template that is stored within viewforum, which either means it's in the database (in which case there's an extra query on the page) or you've been really sneaky and put the info in the compiled template. That or you've just not done it, which would be a bit p00p :/

So, how've you done it? Tell us! :twisted:
Then again...
User avatar
psoTFX
Registered User
Posts: 1984
Joined: Tue Jul 03, 2001 8:50 pm
Contact:

Re: Templating ... a simple guide

Post by psoTFX »

The include tag actually calls a method in the template class. This method checks to see if the template to include has been compiled, if not it does so.

The present CVS requires the admin to manually set forced recompilation (on every page view). I've just added (back) an (optional ... defined in the Load ACP page) recompile when newer template is discovered on filesystem.

There are some complications to this such as updated template files existing on the OS when the DB is being used to store them. I need to (at some point soon) recheck where I was wrt handling this situation.
Roberdin
Registered User
Posts: 1546
Joined: Wed Apr 09, 2003 8:44 pm
Location: London, United Kingdom

Re: Templating ... a simple guide

Post by Roberdin »

Does the method detect for recurisve templates, eg where template A includes tempalte B which inlcudes Template A?
Rob
User avatar
Arty
Former Team Member
Posts: 985
Joined: Wed Mar 06, 2002 2:36 pm
Location: Mars
Contact:

Re: Templating ... a simple guide

Post by Arty »

Roberdin wrote:Does the method detect for recurisve templates, eg where template A includes tempalte B which inlcudes Template A?
As far as i can see from current template.php it doesn't.
haravikk wrote:How efficient is this new system?
Very efficient. I think this is THE most efficient system i've seen. Code in compiled templates is as optimized as it can be (unlike 2.0 where it was very unoptimized). And there is no useless overhead unlike in one other popular almost-free forum system that i'd better not mention.
Post Reply