eZ Community » Forums » Setup & design » Passing attribute to ezxmltext template
expandshrink

Passing attribute to ezxmltext template

Passing attribute to ezxmltext template

Tuesday 19 February 2013 4:36:07 pm - 1 reply

Hi all,

I am trying to adapt a ezwebin based site to a ezdemo-based ergo bootstrap based layout. Most things are working so far, but I have trouble with the ezxmltext-view.

When calling the full/frontpage.tpl I call ezpagedata variables concerning the existance of left_menu or extra_menu and evaluate the column with ergo the span-width as follows

 {set scope=global persistent_variable=hash('left_menu', false(),
                                           'show_path', true(),
                                           'extra_menu', true())}
{def $columns = 16
     $col = 4}
{if $persistent_variable.left_menu}
    {set $columns = $columns|sub(4)}
{/if}
{if $persistent_variable.extra_menu}
    {set $columns = $columns|sub(4)}
{/if}
 
{def $center_col = $columns}
 
{def $frontpagestyle='noleftcolumn norightcolumn'}
 
{if $node.object.data_map.left_column.has_content}
    {set $center_col = $center_col|sub(4)}
{/if}
{if $node.object.data_map.right_column.has_content}
    {set $center_col = $center_col|sub(4)}
{/if}
 
{if $node.object.data_map.left_column.has_content}
    {set $frontpagestyle='leftcolumn norightcolumn'}
{/if}
 
{if eq( $frontpagestyle, 'leftcolumn norightcolumn')}
    {if $node.object.data_map.right_column.has_content}
        {set $frontpagestyle='leftcolumn rightcolumn'}
    {/if}
{else}
    {if $node.object.data_map.right_column.has_content}
        {set $frontpagestyle='noleftcolumn rightcolumn'}
    {/if}
{/if}
 
COLUMNS {$columns}
COL {$col}
CENTER {$center_col}

The values for COLUMN, COL and CENTER seem to be correct. Afterwards when calling the respective column content I try to pass the column width as an argument as follows

 <div class="{$frontpagestyle} row">
{if $node.object.data_map.left_column.has_content}
    <div class="span{$col}">
        <section class="content-view-block content-view-aside">
            {attribute_view_gui attribute=$node.object.data_map.left_column col=$col}
        </section>
    </div>
{/if}
{if $node.object.data_map.center_column.has_content}
    <div class="span{$center_col}">
        <section class="content-view-block" name=xmltagns>
            {attribute_view_gui attribute=$node.object.data_map.center_column col=$center_col}
        </section>
    </div>
{/if}
{if $node.object.data_map.right_column.has_content}
    <div class="span{$col}">
        <section class="content-view-block content-view-aside">
            {attribute_view_gui attribute=$node.object.data_map.right_column col=$col}
        </section>
    </div>
{/if}
</div>

From what I understand next is called the template content/datatype/view/ezxmltext.tpl. When trying to access the variable as follows:

 COL {$col}
{$attribute.content.output.output_text}

I receive error message with

Unknown template variable 'col' in namespace 'xmltagns:ContentView:NodeView:ContentAttribute'

Now my question is if it is possible to generally pass the column width to each ezxmltext attribute called so that I can define the bootstrap-based span-width in each respective call.

Has somebody done something similar or perhaps I have misspelled the topic search within the forum posts. Anyhow I would be very glad if someone could point me in the right direction.

Best wishes

Sebastian

Modified on Tuesday 19 February 2013 4:37:22 pm by Sebastian Schoeller

Saturday 02 March 2013 10:21:52 pm

Hello

try to compare your needs with the ezimage.tpl : you can avoid the error.by declaring a default value ...

I hope it helps..

 

Alex

expandshrink

You must be logged in to post messages in this topic!

36 542 Users on board!

Forums menu

Proudly Developed with from