template and developer tips

Author Message

Samuel Sauder

Tuesday 19 September 2006 7:18:07 am

http://www.wormus.com/aaron/stories/2006/09/19/ezpt-templating-best-practices.html
After reading this I figured I would add some more:
1. if possible avoid sections as they require an additional role/policy configuration.
2. Match[url_alias]=folder/subfolder/node is your friend and it took me awhile to find it in the overrides options. I prefer it instead of matching on node
3. setup a developer siteaccess that has template caching turned off. It is much quicker in the long run versus waiting for the cache reset for every little change.
4. install the Dynamic debug extension
http://ez.no/community/contribs/hacks/dynamic_debug

Aaron Wormus

Tuesday 19 September 2006 7:59:30 am

Thanks, that Dynamic debug extension looks good.

1. Does the role/policy configuration cause any sort of performance slowdown?
2. I've found that without caching turned on the backend is too slow to do anything useful in (other than just editing the ini and tpl files is there any way to get around the speed issue?

Xavier Dutoit

Friday 22 September 2006 7:18:09 am

Hi,

I tend to find more efficient keeping the template caching, but to only disable the template compiling.

X+

http://www.sydesy.com

Xavier Dutoit

Friday 22 September 2006 7:28:55 am

Me again,

About Aaron naming convention, I prefer using folders than what he wrote (if I understood properly):

override/templates/<class>/<view>.tpl

So that's easier when you create a new class (that is often a copy of an existing one): you just copy the directory.

If I have several full views (override based on sections or node id), I tend to give them their functionnal name (it doesn't matter that it is node 42 and I prefer guide/itchhiker_full.tpl ;)

Otherwise, and for those of us that have to develop on the road (ie on a laptop with the client and the server on the same machine), and to keep as much memory free as possible, you can safely lower the number of apache process spawn (no need to have 10 processing swallowing you memory when you'll be the only one that's going to access the server anyway).

X+

P.S. On that scenario, I tend to prefer using lighttpd than apache, but that might be purely subjective.

http://www.sydesy.com

Samuel Sauder

Friday 22 September 2006 7:40:43 am

@X: I'll have to try that out. Thanks for the tip about disable compile instead!

@Aaron: 1. more just being lazy :) In most cases sections are not required because of the power of layering in overrides. In your example

Use Sections: When you want to change the look of a section of your site (ie: I want all the articles in my knowledgebase to have a blue headline) create a section for knowledgebase and then create an override for the class within the section.

You may not need a section. Overriding on class ( Match[class] ) and subtree ( Match[url_alias] ) will suffice.
See: http://ez.no/doc/ez_publish/technical_manual/3_8/reference/template_override_conditions#comment6200

Samuel Sauder

Tuesday 03 October 2006 7:18:06 am

Here's another reference:
http://pubsvn.ez.no/wiki/en/ez/debugging
http://pubsvn.ez.no/wiki/en/ez/developers

Samuel Sauder

Monday 09 October 2006 12:34:05 pm

Another important item on section behavior (advanced). It appears that for the /user/login and edit node views, the pagelayout chosen is smarter so that it doesn't use the default site layout but rather the layout chosen by the section. (I can't find any documentation for this)

The problem I was running into with matching by url_alias, it would always use the default site layout without any option I could think of to override it.

Or is there another way?

Sébastien Antoniotti

Wednesday 17 January 2007 10:39:26 am

Hi,

I "wake up" this topic to ask you about templates path :

I have made a custom class (named "artiste"), and I just want to define templates (.tpl) by using correct folders name, so I have tried this : override/templates/<class>/<view>.tpl (given by Xavier) but it doesn't works...

I have made this path : design/mydesign/override/templates/artiste/line.tpl, but since I cleared the cache many times, when I display an artiste node, the default line.tpl template is used...

thanks in advance !

eZ Publish Freelance
web : http://www.webaxis.fr

Xavier Dutoit

Thursday 18 January 2007 9:36:08 am

And what's the relevant part in your override.append.ini file ?

You don't have to be sorry of being french, it could happend even to the best of us ;)

X+

http://www.sydesy.com

Sébastien Antoniotti

Thursday 18 January 2007 9:56:41 am

Hi,

There is not relevant part in my override.ini because I want to define templates for my custom classes without the override.ini, but by naming templates subfolders and .tpl correctly.

Is it possible ?

eZ Publish Freelance
web : http://www.webaxis.fr

Kristof Coomans

Thursday 18 January 2007 10:06:27 am

I think this was possible a long time ago, am I right about that? But that kind of system isn't used anymore.

independent eZ Publish developer and service provider | http://blog.coomanskristof.be | http://ezpedia.org

Sébastien Antoniotti

Thursday 18 January 2007 10:29:13 am

Ok, so usually you systematically write a rule in the override.ini for each view of each custom class that you create ?

eZ Publish Freelance
web : http://www.webaxis.fr

Paul Borgermans

Thursday 18 January 2007 1:07:35 pm

That's basically it yes. Only "general" templates can be overriden like that.

You could use a wrapper template that looks up each template for each class and each view. But that may slow down things also I think (not measured though)

hth
Paul

eZ Publish, eZ Find, Solr expert consulting and training
http://twitter.com/paulborgermans

Sébastien Antoniotti

Thursday 18 January 2007 2:00:40 pm

ok, thanks to all for your help !

eZ Publish Freelance
web : http://www.webaxis.fr

Powered by eZ Publish™ CMS Open Source Web Content Management. Copyright © 1999-2014 eZ Systems AS (except where otherwise noted). All rights reserved.