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.

eZ debug

Timing: Jan 18 2025 18:39:31
Script start
Timing: Jan 18 2025 18:39:31
Module start 'layout'
Timing: Jan 18 2025 18:39:31
Module start 'content'
Timing: Jan 18 2025 18:39:32
Module end 'content'
Timing: Jan 18 2025 18:39:32
Script end

Main resources:

Total runtime1.5532 sec
Peak memory usage4,096.0000 KB
Database Queries81

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0049 587.7891152.6094
Module start 'layout' 0.00490.0024 740.398439.4297
Module start 'content' 0.00731.5445 779.8281710.3594
Module end 'content' 1.55180.0014 1,490.187516.1953
Script end 1.5532  1,506.3828 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.00350.2222160.0002
Check MTime0.00140.0896160.0001
Mysql Total
Database connection0.00060.041710.0006
Mysqli_queries1.477995.1496810.0182
Looping result0.00120.0800790.0000
Template Total1.517797.720.7589
Template load0.00230.146420.0011
Template processing1.515597.567920.7577
Template load and register function0.00020.013610.0002
states
state_id_array0.00130.081310.0013
state_identifier_array0.00180.114220.0009
Override
Cache load0.00200.1308670.0000
Sytem overhead
Fetch class attribute can translate value0.00090.057250.0002
Fetch class attribute name0.00190.1237100.0002
XML
Image XML parsing0.00110.072750.0002
class_abstraction
Instantiating content class attribute0.00000.0012100.0000
General
dbfile0.00110.0702170.0001
String conversion0.00000.000340.0000
Note: percentages do not add up to 100% because some accumulators overlap

Templates used to render the page:

UsageRequested templateTemplateTemplate loadedEditOverride
1node/view/full.tplfull/forum_topic.tplextension/sevenx/design/simple/override/templates/full/forum_topic.tplEdit templateOverride template
9content/datatype/view/ezxmltext.tpl<No override>extension/community_design/design/suncana/templates/content/datatype/view/ezxmltext.tplEdit templateOverride template
7content/datatype/view/ezxmltags/line.tpl<No override>design/standard/templates/content/datatype/view/ezxmltags/line.tplEdit templateOverride template
13content/datatype/view/ezxmltags/paragraph.tpl<No override>extension/ezwebin/design/ezwebin/templates/content/datatype/view/ezxmltags/paragraph.tplEdit templateOverride template
1content/datatype/view/ezimage.tpl<No override>extension/sevenx/design/simple/templates/content/datatype/view/ezimage.tplEdit templateOverride template
1print_pagelayout.tpl<No override>extension/community/design/community/templates/print_pagelayout.tplEdit templateOverride template
 Number of times templates used: 32
 Number of unique templates used: 6

Time used to render debug report: 0.0002 secs