Forums / Setup & design / ezwebin Template Overrides

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

eZ debug

Timing: Jan 20 2025 17:42:19
Script start
Timing: Jan 20 2025 17:42:19
Module start 'content'
Timing: Jan 20 2025 17:42:19
Module end 'content'
Timing: Jan 20 2025 17:42:20
Script end

Main resources:

Total runtime0.1458 sec
Peak memory usage2,048.0000 KB
Database Queries141

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0063 588.8438180.8359
Module start 'content' 0.00630.0061 769.679797.8984
Module end 'content' 0.01240.1334 867.5781533.2734
Script end 0.1458  1,400.8516 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.00342.3406200.0002
Check MTime0.00130.9183200.0001
Mysql Total
Database connection0.00070.513710.0007
Mysqli_queries0.101469.52101410.0007
Looping result0.00120.80681390.0000
Template Total0.133091.210.1330
Template load0.00090.608310.0009
Template processing0.132190.586010.1321
Override
Cache load0.00060.423210.0006
Sytem overhead
Fetch class attribute can translate value0.00100.663210.0010
XML
Image XML parsing0.00030.199510.0003
General
dbfile0.00443.0485200.0002
String conversion0.00000.003930.0000
Note: percentages do not add up to 100% because some accumulators overlap

CSS/JS files loaded with "ezjscPacker" during request:

CacheTypePacklevelSourceFiles
CSS0extension/community/design/community/stylesheets/ext/jquery.autocomplete.css
extension/community_design/design/suncana/stylesheets/scrollbars.css
extension/community_design/design/suncana/stylesheets/tabs.css
extension/community_design/design/suncana/stylesheets/roadmap.css
extension/community_design/design/suncana/stylesheets/content.css
extension/community_design/design/suncana/stylesheets/star-rating.css
extension/community_design/design/suncana/stylesheets/syntax_and_custom_tags.css
extension/community_design/design/suncana/stylesheets/buttons.css
extension/community_design/design/suncana/stylesheets/tweetbox.css
extension/community_design/design/suncana/stylesheets/jquery.fancybox-1.3.4.css
extension/bcsmoothgallery/design/standard/stylesheets/magnific-popup.css
extension/sevenx/design/simple/stylesheets/star_rating.css
extension/sevenx/design/simple/stylesheets/libs/fontawesome/css/all.min.css
extension/sevenx/design/simple/stylesheets/main.v02.css
extension/sevenx/design/simple/stylesheets/main.v02.res.css
JS0extension/ezjscore/design/standard/lib/yui/3.17.2/build/yui/yui-min.js
extension/ezjscore/design/standard/javascript/jquery-3.7.0.min.js
extension/community_design/design/suncana/javascript/jquery.ui.core.min.js
extension/community_design/design/suncana/javascript/jquery.ui.widget.min.js
extension/community_design/design/suncana/javascript/jquery.easing.1.3.js
extension/community_design/design/suncana/javascript/jquery.ui.tabs.js
extension/community_design/design/suncana/javascript/jquery.hoverIntent.min.js
extension/community_design/design/suncana/javascript/jquery.popmenu.js
extension/community_design/design/suncana/javascript/jScrollPane.js
extension/community_design/design/suncana/javascript/jquery.mousewheel.js
extension/community_design/design/suncana/javascript/jquery.cycle.all.js
extension/sevenx/design/simple/javascript/jquery.scrollTo.js
extension/community_design/design/suncana/javascript/jquery.cookie.js
extension/community_design/design/suncana/javascript/ezstarrating_jquery.js
extension/community_design/design/suncana/javascript/jquery.initboxes.js
extension/community_design/design/suncana/javascript/app.js
extension/community_design/design/suncana/javascript/twitterwidget.js
extension/community_design/design/suncana/javascript/community.js
extension/community_design/design/suncana/javascript/roadmap.js
extension/community_design/design/suncana/javascript/ez.js
extension/community_design/design/suncana/javascript/ezshareevents.js
extension/sevenx/design/simple/javascript/main.js

Templates used to render the page:

UsageRequested templateTemplateTemplate loadedEditOverride
1pagelayout.tpl<No override>extension/sevenx/design/simple/templates/pagelayout.tplEdit templateOverride template
 Number of times templates used: 1
 Number of unique templates used: 1

Time used to render debug report: 0.0002 secs