Template howto

Author Message

Bjarte Lunde

Wednesday 23 July 2003 1:57:34 pm

This is the first time i'm trying to install EZP 3.1.1.
The site works fine, but i don't understand the template system.

Is there any howto on making a custom design?
I've tried to look at the demo site, but it's to advanced.

Can anyone please help me?

Cheers,
- Bjarte

Bård Farstad

Wednesday 23 July 2003 2:06:05 pm

There is quite some information in the documentation. Read the info at:
http://ez.no/developer/ez_publish_3/documentation/customization/custom_design

--bård

Documentation: http://ez.no/doc

Bjarte Lunde

Wednesday 23 July 2003 2:44:32 pm

I've read the info and the documentation, but i don't get any further. The pagelayout.tpl is ok, but i don't understand how to build the menus and views. I'm trying to copy the design i have today on bamboosh.com into EZP and not use frames...

Kjerand Pedersen

Wednesday 23 July 2003 3:10:51 pm

You can make templates files (with .tpl extension) and put them in your /design/user/templates directory (if 'user' is your site directory).

Put the template-code and html in these files and include them from your pagelayout template, where you want them to appear, like this:

{include uri="design:your_template.tpl"}

For example, this is the code I use to display the latest 5 forum messages in the right column of the site I'm setting up:

<literate>
-------------------------------
<table width="120" border="0" cellpadding="5" cellspacing="0">
<tr>
<td bgcolor="#000000">
<b class="smalltitle">Last 5 messages</b><br>
{section name=Message loop=fetch( content, tree, hash(
parent_node_id, 73,
limit, 5,
sort_by, array( published, false() ),
class_filter_type, include,
class_filter_array, array( 7 ) ) ) }


<span class="menu"> &#8226; </span><a class="menu" href={concat( "/content/view/full/", $Message:item.node_id, "/" )|ezurl}>{$Message:item.name|wash}</a><br>

{/section}
</td>
</tr>
</table>
--------------------------
</literate>

Templates to view objects (nodes) should be stored in /design/user/overide/templates/ and initilized by editing the override.ini file. Take a look in the /settings/siteaccess/demo/ directory to see how it is set up and locate the templates in /design/demo/override/templates/. Try editing the template files and see how it is displayed on the demo site.

Remember to turn off view cachin in site.ini (search for "ViewCaching" and set it to disabled), or else you won't see your changes.

Hope this help you getting started.

Pirkka Hartikainen

Thursday 24 July 2003 4:12:26 pm

Thanks for the informative reply, Kjerand! I'm also trying to figure this template system out, here are two more questions..

Is there any way to override design/user/templates/pagelayout.tpl so that it will not be overwritten when upgrading to the next version?

Which one is the recommended practice here: a) start hacking the design/user directory or b) create your own design/mydesign directory?

Bjørn Kaarstein

Thursday 24 July 2003 11:39:35 pm

Hi Pirkka.

I would make my own custom design folder.

Then you would use design/mydesign/templates/pagelayout.tpl

Regards Bjørn

Kjerand Pedersen

Friday 25 July 2003 5:05:46 am

Simply put pagelayout.tpl in the /design/user/override/templates directory (if user is your site dir) to override the pagelayout file.

Bjarte Lunde

Friday 25 July 2003 5:17:18 am

Hello.. Finally i've startet to understand how to customize the templates. But when i started on the forum template, my menu vanish... Why?

By the way; thanx for all help!
Who's in on starting a ez tutorial project?

Pirkka Hartikainen

Monday 28 July 2003 4:23:43 pm

>Simply put pagelayout.tpl in the /design/user/override/templates
>directory (if user is your site dir) to override the pagelayout file.

This doesn't seem to work with 3.1's override.ini mechanism, while it worked with version 3.0 (correct me if I'm wrong!!!).

How do I configure override.ini to override a template for ALL nodes, classes and sections?

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