Forums / Setup & design / Templates

Templates

Author Message

Aaron Carlino

Tuesday 27 February 2007 8:02:34 am

Just getting into building a site with ezPublish, and wondering if I understand this correctly.

I went through the installation and created a site using the "plain" template, as I wanted to build my own design. The site name took on the default name "plain."

Now, on my server, in the design folder, I have a "plain" folder with /stylesheets/ and /templates/ and other folders. As I understand it, if I put a "pagelayout.tpl" in /design/plain/templates/ it should take on that template. If it's not there, it will fall back to /design/templates/standard/, is that correct?

If so, does anyone have any ideas why my site would not be defaulting to the pagelayout.tpl in /design/plain/templates/?

Aaron Carlino

Tuesday 27 February 2007 8:21:47 am

Cleared the template cache, I think it fixed the problem. Anyone have anything to add?

André R.

Tuesday 27 February 2007 11:09:06 am

It was probably the template override cache.

A good idea would be to enable DevelopmentMode.

[TemplateSettings]
DevelopmentMode=enabled

You have the fallback system correct, and you can also use the override system to override spesific templates under spesific conditions (node_id, class and so on). Override templates is placed in the override directory, and those also have the same fallback functionality.

eZ Online Editor 5: http://projects.ez.no/ezoe || eZJSCore (Ajax): http://projects.ez.no/ezjscore || eZ Publish EE http://ez.no/eZPublish/eZ-Publish-Enterprise-Subscription
@: http://twitter.com/andrerom

Aaron Carlino

Tuesday 27 February 2007 12:39:47 pm

What do I do if I want to change the way a certain node gets rendered? I found in /base/override/templates a bunch of .tpl files. If I change them there, it will have a global effect, but what if I just want the change on one site? I tried throwing a new article.tpl file into /design/mysite/templates/ but it didn't work.

Also, say I create my own content class. I have to make a template for that, but where do I put it and how do I name it?

Mark Marsiglio

Tuesday 27 February 2007 1:06:56 pm

You can change the file in base/override, but really what you should do (a little more complex, but more portable and upgrade-proof) is create your own design folder. Any files in that folder (which has a similar structure to base/ design) will automatically override a file with the same name in the base and standard design folders.

To override a single node, you will want to add an override to the override.ini.append.php in your settings/siteaccess/your_site folder. There are some others in there that will give you an example of the formatting, and there are docs on this site about overrides.

Match[node]=105 or something is the line that will tell it to only apply to one page. You can override based on [class], [section], and several other factors.

http://www.thinkcreative.com
Turning Ideas Into Strategic Solutions

Mark Marsiglio

Tuesday 27 February 2007 1:18:50 pm

Sorry - just read your original post. You should have a design/plain folder (which you can rename btw if you update the site.ini.append.php for your site to the new name for the design) which you will want to edit files specific to your site. There is an override folder in there, and if you wanted to change the layout of the full view of the folder class, you would edit the plain/override/templates/full/folder.tpl file. If there is not one there, copy the on the base design, and save in your plain design and edit it there.

http://www.thinkcreative.com
Turning Ideas Into Strategic Solutions

Aaron Carlino

Wednesday 28 February 2007 10:22:44 am

Great. Thanks a lot for your help. And as far as building a new class, do I just create a file called my_class_name.tpl and put it in my /design/plain/templates?