Forums / Setup & design / Where to put templates?

Where to put templates?

Author Message

Douglas Hammond

Tuesday 09 September 2003 8:57:46 am

where should i put tempalte int templates or template/override ?

It looks like i can put them in eaither.

I have the following

<?php /* #?ini charset="utf8"?

[frontpage_pagelayout]
Source=pagelayout.tpl
MatchFile=frontpage_pagelayout.tpl
Subdir=templates
Match[section]=1

[frontpage_line_article]
Source=node/view/line.tpl
MatchFile=frontpage_line_article.tpl
Subdir=templates
Match[section]=1
Match[class]=2

*/ ?>

and i can put the files in either place.

Whats best practice?

Bjørn Kaarstein

Tuesday 09 September 2003 10:25:17 pm

I like to keep my overrides in the override directory, as I think it's more logic to seperate them from the pagelayout file with includes.

Also, if you have the need of overriding ezxmltags or something, they are to be placed in the override directory with the same directory structure as in the standard folder. Those won't have to be specified in your override.ini.append.

Well, that's my point of view - Now for some coffee.

Regards Bjørn

Paul Forsyth

Wednesday 10 September 2003 12:20:45 am

If you are trying to override a template that currently exists you must put *your* new template into the overrides directory. Thats where ez will expect your override to be.

When you declare an override, as you given in your example, it must be put into the templates/override directory otherwise ez falls back on the original.

Paul

Douglas Hammond

Wednesday 10 September 2003 9:22:06 am

That's not the case.

I will use override/templates for now on but i can place my template file in moy above example in either templates or overrride/templates

Is this a bug?

Paul Borgermans

Wednesday 10 September 2003 9:29:03 am

No, its like intented. After experimenting (and the course in Skien), this the current status: there are actually 3 levels / places which determine which templates are used.

The default is to use: /design/standard/templates/.....

This can be overriden by templates in exactly the same directory structure inside /design/<yourdesign>/templates. You can call this the "default" site specific templates. (you may copy the entire folder inside /design/standard/templates/ to this one if you want to make changes to the defaults from standard).

The third one (and which has precedence over the above two) is through the override.ini file. What you specify here lives in /design/<yourdesign>/override/templates if you specify a SubDir=templates

Does that clarify something?

-paul

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

Pontus Magnusson

Thursday 05 August 2004 9:43:22 am

Acttually I can put them in either directory. For example, with this override:

[homepage]
Source=pagelayout.tpl
MatchFile=homepage.tpl
Subdir=templates
Match[node]=2

My homepage.tpl can be in templates/ or override/templates/, it still work...