ezwebin Template Overrides

Author Message

Betsy Gamrat

Friday 22 December 2006 10:50:01 am

I modified menu/flat_top.tpl through the admin interface, but the override template was not used in the display.

I'm not sure it if is a bug, or if this template is not intended to be modified.

As a side note, this is the modification:

I created a new class called <b>Navigation</b>, which consists of two attributes, a <i>name</i> and an <i>object relation list</i>. Next, I created the content and related it to the items I wanted in the navigation. Finally, I modified the template to use the node, and added an <b>Edit</b> link (using the eZ logo image). This allows the navigation of ezwebin to be managed by through the website interface in addition to the admin interface. It also allows content to be 'hidden' by preventing its display in the navigation.

$top_menu_root_node is the node which contains the object relation list. I just hard-coded the node id (145) in to the template, a more graceful approach is certainly possible.

<b>menu/flat_top.tpl</b>

 <div class="topmenu-design">
    <!-- Top menu content: START -->
        <ul>
        {def $root_node=fetch( 'content', 'node', hash( 'node_id', $indexpage ) )
        $top_menu_root_node=fetch( 'content', 'node', hash( 'node_id', 145 ) )
        $top_menu_items=fetch( 'content', 'related_objects',hash( 'object_id',$top_menu_root_node.contentobject_id,'all_relations', true()) )
        $top_menu_items_count = $top_menu_items|count()
        $item_class = array() $item = array()
        $current_node_in_path = cond(and($current_node_id, gt($module_result.path|count, $pagerootdepth)), $module_result.path[$pagerootdepth].node_id, 0
)}
    {set $pagerootdepth = $root_node.depth}
        {if $top_menu_root_node.can_edit}
        <li class="edit-nav"><a href={concat('/content/edit/',$top_menu_root_node.contentobject_id)|ezurl} title="Edit navigation items"><img src={'images/
ez_toolbar.png'|ezdesign(no)}></a></li>
    {/if}

    {if $top_menu_items_count}
       {foreach $top_menu_items as $key => $item_obj}
            {set $item = $item_obj.main_node}
            {set $item_class = cond($current_node_in_path|eq($item.node_id), array("selected"), array())}
            {if $key|eq(0)}
                {set $item_class = $item_class|append("firstli")}
            {/if}
            {if $top_menu_items_count|eq( $key|inc )}
                {set $item_class = $item_class|append("lastli")}
            {/if}
            {if $item.node_id|eq( $current_node_id )}
                {set $item_class = $item_class|append("current")}
            {/if}

            {if eq( $item.class_identifier, 'link')}
            <li id="node_id_{$item.node_id}"{if $item_class} class="{$item_class|implode(" ")}"{/if}><div><a href={if eq( $ui_context, 'browse' )}{concat("
content/browse/", $item.node_id)|ezurl}{else}{$item.data_map.location.content|ezurl}{/if} target="_blank"{if eq( $ui_context, 'edit' )} onclick="return fal
se;"{/if}><span>{$item.name|wash()}</span></a></div></li>
            {else}
                <li id="node_id_{$item.node_id}"{if $item_class} class="{$item_class|implode(" ")}"{/if}><div><a href={if eq( $ui_context, 'browse' )}{conc
at("content/browse/", $item.node_id)|ezurl}{else}{$item.url_alias|ezurl}{/if}{if eq( $ui_context, 'edit' )} onclick="return false;"{/if}><span>{$item.name|
wash()}</span></a></div></li>
                {/if}
        {/foreach}
    {/if}
    {undef $root_node $top_menu_items $item_class $top_menu_items_count $current_node_in_path $top_menu_root_node}
    </ul>
    <!-- Top menu content: END -->
</div>

Kristof Coomans

Friday 22 December 2006 10:40:30 pm

Hi Betsy

Can you tell us where the override template is located now? Is it in a design under the main design/ dir?

There's a problem with the order the design resources are used, see bug http://issues.ez.no/9595 , it could be related to your problem. First of all the order of the design resources differs between ezimage/ezdesign template operators and template fetching. But there's more: extension designs are always used before designs in the main design/ dir. Because the ezwebin design is in an extension, this could be the issue here.

independent eZ Publish developer and service provider | http://blog.coomanskristof.be | http://ezpedia.org

Betsy Gamrat

Saturday 23 December 2006 8:27:22 pm

Kristof,

I tried to use the admin console to create the override template, and it looked like it created it in the ezwebin/design/ezwebin/override/templates directory, but the changes didn't take effect.

My solution was just to modify the ezwebin/design/ezwebin/design/menu/flat_top.tpl file, which worked well.

Betsy

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 19 2025 03:17:38
Script start
Timing: Jan 19 2025 03:17:38
Module start 'layout'
Timing: Jan 19 2025 03:17:38
Module start 'content'
Timing: Jan 19 2025 03:17:39
Module end 'content'
Timing: Jan 19 2025 03:17:39
Script end

Main resources:

Total runtime0.8219 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.0082 589.1563152.6250
Module start 'layout' 0.00830.0039 741.781339.4453
Module start 'content' 0.01220.8083 781.2266557.6484
Module end 'content' 0.82050.0014 1,338.875016.1641
Script end 0.8219  1,355.0391 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.00360.4372160.0002
Check MTime0.00140.1748160.0001
Mysql Total
Database connection0.00150.178210.0015
Mysqli_queries0.765493.1253570.0134
Looping result0.00080.0945550.0000
Template Total0.780995.020.3904
Template load0.00190.227620.0009
Template processing0.779094.773920.3895
Template load and register function0.00010.012310.0001
states
state_id_array0.00170.210710.0017
state_identifier_array0.00090.109720.0005
Override
Cache load0.00160.1923220.0001
Sytem overhead
Fetch class attribute can translate value0.00040.049820.0002
Fetch class attribute name0.00100.119650.0002
XML
Image XML parsing0.00090.104720.0004
class_abstraction
Instantiating content class attribute0.00000.001060.0000
General
dbfile0.00100.1166220.0000
String conversion0.00000.001740.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/ezimage.tpl<No override>extension/sevenx/design/simple/templates/content/datatype/view/ezimage.tplEdit templateOverride template
3content/datatype/view/ezxmltext.tpl<No override>extension/community_design/design/suncana/templates/content/datatype/view/ezxmltext.tplEdit templateOverride template
3content/datatype/view/ezxmltags/paragraph.tpl<No override>extension/ezwebin/design/ezwebin/templates/content/datatype/view/ezxmltags/paragraph.tplEdit templateOverride template
1content/datatype/view/ezxmltags/literal.tpl<No override>extension/community/design/standard/templates/content/datatype/view/ezxmltags/literal.tplEdit templateOverride template
1print_pagelayout.tpl<No override>extension/community/design/community/templates/print_pagelayout.tplEdit templateOverride template
 Number of times templates used: 12
 Number of unique templates used: 6

Time used to render debug report: 0.0001 secs