node_view_gui skips output using override

Author Message

Martin B

Monday 11 December 2006 11:04:59 am

Hi folks,

I'm using eZ 3.8.

I've got a template like this (excerpt):

	{def $oldlinks=fetch(content, list, hash('parent_node_id', $node.node_id, 'class_filter_type', 'include', 'class_filter_array', array('link_mag')))}
	<table style="text-align: center;" class="linkmag_archive_table">
		<tbody>
{foreach $oldlinks as $oldlink}
			<!-- table row from other template -->
{node_view_gui content_node=$oldlink view=archivetable}
{/foreach}

the node_view_gui should spawn another template called linkmag_archive_tablerow.tpl. It is in the override/templates folder of our custom design folder where all other (working) templates are. Here is the override condition (all my other override conditions in the same spot work):

[linkmag_archive_tablerow]
Source=node/view/full.tpl
MatchFile=linkmag_archive_tablerow.tpl
Subdir=templates
Match[viewmode]=archivetable
Match[class_identifier]=link_mag

Most of it is copied from other (working) overrides.
However, the node_view_gui command in the template just renders... nothing. At all. I can't even get any debug output about it. Nothing at all.

I've tried changing it to Source=node/view/archivetable.tpl but that changed nothing.

I've cleared the cache several times. The class_identifier is correct, too. The override is the first in override.ini.append.php.
When I delete the override condition (and clear the caches) I get the same.

This problem has truly confounded me and I would really appreciate any help. Thanks.

Martin B

Monday 11 December 2006 11:07:35 am

Just to make sure: the foreach loop gives me good nodes, too.

Martin B

Wednesday 13 December 2006 9:43:43 am

Sorry to bump this topic in such a way, but I narrowed down the problem a bit.
It's definitely to do with the custom view, I can put in a full view without problems.

Can someone tell me how I need to set up an override when I'm using my own view mode (i.e. not full, line or anything that exists already)?

Claudia Kosny

Wednesday 13 December 2006 10:44:24 am

Hi Martin

First of all remove the override condition again. If you specify a view 'archivetable', this view will be used, so overriding the view 'full' is not necessary (and does not help). Then make sure that you have a template called 'archivetable.tpl' in the folder design/<design_dir>/templates/node/view or design/<design_dir>/override/templates/node/view (I usually use the override folder but as far as I know it does not matter). Enable full debug output, especially the list of used templates and the template debug option. Then clear the cache and try again.

If it still does not work, check the debug output - what template is it trying to load? If necessary surround the loop in the template with a {debug-timing-point id=...}, this might make it easier to find the relevant messages.

Claudia

Martin B

Thursday 14 December 2006 4:43:02 am

Hi Claudia,

thanks, that provided me exactly with the missing information.
Overriding my own node/view template still doesn't seem to work, but I guess I don't need that any more.

Christian Johansen

Saturday 16 December 2006 12:42:43 am

You can make your own view modes, and if you always have overrides, you don't need to have the base file in place. Example:

In some template you do

{def $node_list=fetch('content', 'list'
                      hash('parent_node_id', $node.node_id,
                           'class_filter_type', 'include',
                           'class_filter_array', array('someclass')))}

Now you are asking for the view "archivetable", which doesn't exist by default. That's not a problem - it doesn't even have to exist at all, as long as eZ can find it's override file. It's important to note also that you are overriding the view mode, which is "archivetable", not "full".

[linkmag_archive_tablerow]
Source=node/view/archivetable.tpl
MatchFile=linkmag_archive_tablerow.tpl
Subdir=templates
Match[class_identifier]=link_mag

So, it doesn't matter that node/view/blabla.tpl doesn't exist, as long as you have enought control to know that you won't ask for the view "blabla" for any node that doesn't override this template. It sounds complicated, but in practice it works great for me.

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 14:55:42
Script start
Timing: Jan 18 2025 14:55:42
Module start 'layout'
Timing: Jan 18 2025 14:55:42
Module start 'content'
Timing: Jan 18 2025 14:55:44
Module end 'content'
Timing: Jan 18 2025 14:55:44
Script end

Main resources:

Total runtime1.8568 sec
Peak memory usage4,096.0000 KB
Database Queries68

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0141 589.1250153.4688
Module start 'layout' 0.01410.0044 742.593839.4219
Module start 'content' 0.01861.8370 782.0156545.8672
Module end 'content' 1.85560.0012 1,327.882816.1250
Script end 1.8568  1,344.0078 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.00350.1885160.0002
Check MTime0.00130.0721160.0001
Mysql Total
Database connection0.00170.090310.0017
Mysqli_queries1.787096.2387680.0263
Looping result0.00060.0345660.0000
Template Total1.795096.720.8975
Template load0.00250.132620.0012
Template processing1.792596.537120.8963
Template load and register function0.00020.008110.0002
states
state_id_array0.00240.129110.0024
state_identifier_array0.00130.069720.0006
Override
Cache load0.00190.1049370.0001
Sytem overhead
Fetch class attribute can translate value0.00070.039230.0002
Fetch class attribute name0.00100.053560.0002
XML
Image XML parsing0.00040.024130.0001
class_abstraction
Instantiating content class attribute0.00000.000660.0000
General
dbfile0.00160.0884100.0002
String conversion0.00000.000540.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
6content/datatype/view/ezxmltext.tpl<No override>extension/community_design/design/suncana/templates/content/datatype/view/ezxmltext.tplEdit templateOverride template
12content/datatype/view/ezxmltags/paragraph.tpl<No override>extension/ezwebin/design/ezwebin/templates/content/datatype/view/ezxmltags/paragraph.tplEdit templateOverride template
4content/datatype/view/ezxmltags/literal.tpl<No override>extension/community/design/standard/templates/content/datatype/view/ezxmltags/literal.tplEdit templateOverride template
4content/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: 28
 Number of unique templates used: 6

Time used to render debug report: 0.0001 secs