ibexa

Caution: This documentation is for eZ Publish legacy, from version 3.x to 5.x.

node_view_gui

Summary

Outputs the view template for a node.

Usage

{node_view_gui content_node=node [ view=view_mode  [ parameter=value [ ... ] ] ]}

Parameters

NameTypeDescriptionRequired
content_node object The target node (as an ezcontentobjecttreenode object). Yes.
view string The view mode that should be used. Yes.
parameter any Parameter(s) that will be passed to the included template. No.

Description

This function makes it possible to display a node using its view (or override) template. The target node must be specified as an "ezcontentobjecttreenode" object using the "content_node" parameter. The "view" parameter specifies which view mode that should be used. All other parameters (of any type) will be passed on and thus become available as template variables in the view template.

Examples

Example 1

{def $my_node=fetch( 'content', 'node', hash( 'node_id', 96 ) )}
{node_view_gui view='example' content_node=$my_node}

In this example, node number 96 is fetched and stored in $my_node. The "node_view_gui" function is used to display the target node using the "example" view mode. If there are no override rules for the specified view mode, the system will search for "example.tpl" in the "templates/node/view/" directory of the current design. If the requested template file is not found, eZ Publish will continue searching for it in the fallback designs and the standard design.

Balazs Halasy (06/02/2004 1:17 pm)

Julia Shymova (18/09/2007 12:06 pm)

Balazs Halasy, Ole-Morten Halvorsen, Julia Shymova


Comments

  • Parameter use ?

    Maybe that the optional parameter usage should be detailed.

    Which syntax should be used ?
    • Re: Parameter use ?

      Additional [unlimited?] parameters can be passed to the template specified by the 'view' parameter. Additional parameters may have any name, provided it does not conflict with other, specified, parameter names (ie. 'view' and 'content_node') and adhere to standard eZtemplate variable naming conventions. [Other limitations?]

      eg.
      {node_view_gui
      	content_node=$my_node
      	view='full'
      	my_first_parameter=true()
      	my_second_parameter=1
      	my_third_parameter='some text'
      }
      
  • Intention of the various 'Standard' views?

    Some documentation regarding the intended use of the various 'views' available in the 'Standard' templates would be helpful. Especially when deciding how/whether to override a template for a particular purpose. [I have not been able to find comprehensive documentation in this regard.]