Forums / Setup & design / node_view_gui skips output using override

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.