Overriding View Templates For Datatypes

Author Message

Tristan Koen

Friday 23 May 2003 1:20:58 am

I have a custom template for an article object that contains an embedded object. When displaying the embedded object using
{attribute_view_gui attribute=$node.object.data_map.related_object}
all I get is the name of the related object.
Ideally, I would like to display a number of the attributes of the related object here.

Looking through the forums and howto documents, it appears that some people have had some success by placing an embed_class_XX.tpl file in the design/mySchema/override/templates/content/view directory, but only with an embedded object id in an XML attribute.

Looking at the debug output, the default related object output is determined by /design/standard/templates/content/datatype/view/ezobjectrelation.tpl.

Anyone have any idea how to override this template for a specific class?

Selmah Maxim

Friday 23 May 2003 3:43:13 am

Hi ..

u can copy /design/standard/templates/content/datatype/view/ezobjectrelation.tpl

to
/design/MYDISIGN/templates/content/datatype/view/ezobjectrelation.tpl

Let`s say u wanna get foreach class another look from Ezobectrelation, the pass vars to ezobectrelation.tpl :

{attribute_view_gui attribute=$node.object.data_map.related_object Classid=7}

then is ezobectrelation.tpl :

{switch match=$Classid}
{case match=7}{*class # 7}
LALALA
{/case}
{case match=8}{*class # 8}
LALALA
{/case}
.
..
{/switch}

thats it !

Tristan Koen

Friday 23 May 2003 6:50:50 am

Hi Selmah,

Thanks for the idea. It would definitely work, but it is a bit of a hack. Surely there must be a mechanism within the ezPublish framework that would do the trick?
If there is no such mechanism, then I have to question why bother with related objects? It is far cleaner and more maintainable to place an object reference into an XML text attribute (in my opinion anyway).

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 11:24:51
Script start
Timing: Jan 18 2025 11:24:51
Module start 'layout'
Timing: Jan 18 2025 11:24:51
Module start 'content'
Timing: Jan 18 2025 11:24:52
Module end 'content'
Timing: Jan 18 2025 11:24:52
Script end

Main resources:

Total runtime0.7530 sec
Peak memory usage4,096.0000 KB
Database Queries57

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0071 588.0313152.6406
Module start 'layout' 0.00710.0031 740.671939.4766
Module start 'content' 0.01020.7416 780.1484472.3359
Module end 'content' 0.75170.0013 1,252.48448.1406
Script end 0.7530  1,260.6250 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.00340.4484160.0002
Check MTime0.00140.1802160.0001
Mysql Total
Database connection0.00060.076210.0006
Mysqli_queries0.700893.0608570.0123
Looping result0.00060.0803550.0000
Template Total0.714294.820.3571
Template load0.00220.287920.0011
Template processing0.712094.553420.3560
Template load and register function0.00030.041810.0003
states
state_id_array0.00190.255910.0019
state_identifier_array0.00200.265420.0010
Override
Cache load0.00180.2342330.0001
Sytem overhead
Fetch class attribute can translate value0.00040.056520.0002
Fetch class attribute name0.00210.275030.0007
XML
Image XML parsing0.00020.026920.0001
class_abstraction
Instantiating content class attribute0.00000.001330.0000
General
dbfile0.00070.0928100.0001
String conversion0.00000.001240.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
3content/datatype/view/ezxmltext.tpl<No override>extension/community_design/design/suncana/templates/content/datatype/view/ezxmltext.tplEdit templateOverride template
4content/datatype/view/ezxmltags/line.tpl<No override>design/standard/templates/content/datatype/view/ezxmltags/line.tplEdit templateOverride template
6content/datatype/view/ezxmltags/paragraph.tpl<No override>extension/ezwebin/design/ezwebin/templates/content/datatype/view/ezxmltags/paragraph.tplEdit templateOverride template
1print_pagelayout.tpl<No override>extension/community/design/community/templates/print_pagelayout.tplEdit templateOverride template
 Number of times templates used: 15
 Number of unique templates used: 5

Time used to render debug report: 0.0001 secs