Page 1 of 1
how to create more page attributes
Posted: Mon May 19, 2014 1:51 am
by lazut
how can I create a variable to specific the page other than three extra page attributes so I can call that variable in menu manager template. There is a section labeled "Smarty data or logic that is specific to this page" but I couldn't find any example related this topic. Or is there a way to call page content block values in menu manager to make some comparisons . I tried it like this;
Code: Select all
{content block="page extra attribute " assign="extra5" oneline="true"}
I created menu template
Code: Select all
{foreach from=$nodelist item='node'}
{if $extra5=="test" }
<div class="thumbnail col-med-3">
<a href="{$node->url}" class=" ">
<img class="img-responsive" src="{$node->thumbnail}" title="{$node->extra1}">
<div class="caption">
<h5 class="text-center">{$node->raw_menutext}<br></h5>
</a>
<p><a href="{$node->url}" class="btn btn-default" role="button">Learn More</a></p>
</div>
</div>
</div>
{/if}
{/foreach}
and I created page and added this code
Code: Select all
{menu template="test" show_all='1' collapse='0'}
nothing happened and the page which has $extra5=="test" is active and show in menu option is clicked.
Re: how to create more page attributes
Posted: Mon May 19, 2014 8:52 am
by velden
Only the default 3 page attributes are available in Menu Manager.
However, there is a way to get content of other content blocks in Menu Manager.
You will need CGSimpleSmarty module. Read the module's help for get_page_content function
Code: Select all
{cgsimple::get_page_content($node->alias,'extra5','extra5')}
I think it's more efficient to use one of the 3 default page attributes though. I just wonder why you need so many?
Re: how to create more page attributes
Posted: Tue May 20, 2014 1:41 am
by lazut
I couldn't use product module because I got fatal error message during installation so each page in the site created as a product page and right now I am using menu manager template to create and classify related products to each pages . may be it's not efficient way but this is the solution I have found , code example is like this ;
Code: Select all
{capture assign='foo'}{$content_obj->GetPropertyValue('extra2')}{/capture}
{foreach from=$nodelist item='node'}
{if $node->extra1 =="Travertine Pavers" && $node->extra2 =="$foo" || $node->extra1 =="Limestone Pavers" && $node->extra2 =="$foo" || $node->extra1 =="Marble Pavers" && $node->extra2 =="$foo" || $node->extra1 =="Travertine Mosaic Tile" && $node->extra2 =="$foo" || $node->extra1 =="Limestone Mosaic Tile" && $node->extra2 =="$foo" || $node->extra1 =="Marble Mosaic Tile" && $node->extra2 =="$foo" || $node->extra1 =="Travertine Split Face Tile" && $node->extra2 =="$foo" || $node->extra1 =="Limestone Split Face Tile" && $node->extra2 =="$foo" || $node->extra1 =="Limestone Tile" && $node->extra2 =="$foo" || $node->extra1 =="Travertine Tile" && $node->extra2 =="$foo" || $node->extra1 =="Marble Tile" && $node->extra2 =="$foo" }
I have created menu templates for each categories and product types.
Re: how to create more page attributes
Posted: Tue May 20, 2014 6:51 am
by velden
I think I'd rather try to fix the fatal error on the Products module, or use another module.
This just seems to be very inflexible (hard coded) and inefficient.
Re: how to create more page attributes
Posted: Mon Sep 29, 2014 8:22 pm
by Dr.CSS
You need to make sure you have at least PHP 5.3.* to use the Products module, or any of the CG modules...
Re: how to create more page attributes
Posted: Mon Sep 29, 2014 9:20 pm
by psy
{content block="page extra attribute " assign="extra5" oneline="true"}
Content block parameter must be url friendly, eg 'page-extra-attribute'. For longer names, add the label parameter, eg:
Code: Select all
{content block='extra-page-attribute' label='Extra page attribute' assign='extra5' oneline='true'}
This is also inefficient:
{capture assign='foo'}{$content_obj->GetPropertyValue('extra2')}{/capture}
Better to use:
Code: Select all
{$foo=$content_obj->GetPropertyValue('extra2')}
Agree 100% with Dr.CSS' and velden's advice...