Class Templates

Author Message

Rob Clews

Tuesday 16 December 2003 7:03:09 am

Hi,

Is it possible to create a full page layout template dependant upon the class of the content you are viewing? I can only only seem to find examples of the main area but not headers/navigation etc.

Cheers
Rob Clews

Paul Forsyth

Tuesday 16 December 2003 7:22:39 am

It should as you can match by class. Have you tried something like this:

[my_pagelayout_for_folders]
Source=pagelayout.tpl
MatchFile=pagelayout_folders.tpl
Subdir=templates
Match[class]=1

[my_pagelayout_for_articles]
Source=pagelayout.tpl
MatchFile=pagelayout_articles.tpl
Subdir=templates
Match[class]=2

I've not tried this but give it a go.

paul

Rob Clews

Tuesday 16 December 2003 7:45:11 am

Paul, cheers, but I already have that and the template file, copied from another example, does not include all the html of the page, just the "main area" html. Or am I missing something here.

Basically I want a different page header dependant upon what the class is.

Rob

Paul Forsyth

Tuesday 16 December 2003 7:53:30 am

Well the main area is inserted via the

{$module_result.content}

command. The rest will be as specified in the pagelayout.

Do you have caching on? The layout may be being cached. Try clearing all caches to find if this is the problem.

An alternative path is to include the page top within each of your templates instead of the layout. This isn't quite as good as using a separate pagelayout but is a workaround.

Ill be surprised if the override solution doesn't work.

paul

Rob Clews

Tuesday 16 December 2003 8:10:38 am

Ahh, I see what it's doing now, heres what I have:

[pagelayout_for_my_class]
Source=pagelayout.tpl
MatchFile=newpagelayout.tpl
Subdir=templates
Match[class]=17

However on every page regardless of class I get the following in debug, with no html on the page other than the debug information:

Warning: eZTemplate Dec 16 2003 17:45:57

No template could be loaded for "pagelayout.tpl" using resource "design"

Thanks
Rob

Paul Forsyth

Tuesday 16 December 2003 9:33:20 am

Hmm, at least its looking for the file.

Try to make the group heading the same as the template name. I think my example was wrong. Thought im not 100% this needs to be done, but its worth a try:

[newpagelayout]
Source=pagelayout.tpl
MatchFile=newpagelayout.tpl
Subdir=templates
Match[class]=17

Is your new file within:

design/<your-design>/override/templates ?

Are file permissions correct for this file?
paul

Rob Clews

Wednesday 17 December 2003 3:19:40 am

Ok, the ini setting is as you've stated, and the permissions are 666, owner www (apache user).

Still get the same problem! Is it possible to override pagelayout.tpl?

Thanks

Paul Forsyth

Wednesday 17 December 2003 4:14:35 am

It is possible. Look at the file:

settings/siteaccess/demo/override.ini.append

It has loads of pagelayout overrides in there.

Are you sure you are clearing the cache? Remove everything in var/cache if in doubt.

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 20:48:06
Script start
Timing: Jan 18 2025 20:48:06
Module start 'layout'
Timing: Jan 18 2025 20:48:06
Module start 'content'
Timing: Jan 18 2025 20:48:07
Module end 'content'
Timing: Jan 18 2025 20:48:07
Script end

Main resources:

Total runtime0.7856 sec
Peak memory usage4,096.0000 KB
Database Queries72

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0097 588.9063152.6094
Module start 'layout' 0.00970.0049 741.515639.4297
Module start 'content' 0.01460.7694 780.9453527.6484
Module end 'content' 0.78400.0016 1,308.593816.1953
Script end 0.7856  1,324.7891 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.00380.4803160.0002
Check MTime0.00140.1770160.0001
Mysql Total
Database connection0.00260.332910.0026
Mysqli_queries0.706589.9361720.0098
Looping result0.00100.1227700.0000
Template Total0.727492.620.3637
Template load0.00260.325020.0013
Template processing0.724892.266420.3624
Template load and register function0.00030.032110.0003
states
state_id_array0.00160.209310.0016
state_identifier_array0.00100.131320.0005
Override
Cache load0.00220.2792660.0000
Sytem overhead
Fetch class attribute can translate value0.00070.084420.0003
Fetch class attribute name0.00100.130780.0001
XML
Image XML parsing0.00020.029420.0001
class_abstraction
Instantiating content class attribute0.00000.001880.0000
General
dbfile0.00580.7415100.0006
String conversion0.00000.002440.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
8content/datatype/view/ezxmltext.tpl<No override>extension/community_design/design/suncana/templates/content/datatype/view/ezxmltext.tplEdit templateOverride template
15content/datatype/view/ezxmltags/paragraph.tpl<No override>extension/ezwebin/design/ezwebin/templates/content/datatype/view/ezxmltags/paragraph.tplEdit templateOverride template
7content/datatype/view/ezxmltags/line.tpl<No override>design/standard/templates/content/datatype/view/ezxmltags/line.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: 5

Time used to render debug report: 0.0002 secs