how to create more page attributes

The place to talk about things that are related to CMS Made simple, but don't fit anywhere else.
Locked
lazut
Forum Members
Forum Members
Posts: 15
Joined: Thu Dec 22, 2011 3:54 pm

how to create more page attributes

Post 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.
User avatar
velden
Dev Team Member
Dev Team Member
Posts: 3497
Joined: Mon Nov 28, 2011 9:29 am

Re: how to create more page attributes

Post 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?
lazut
Forum Members
Forum Members
Posts: 15
Joined: Thu Dec 22, 2011 3:54 pm

Re: how to create more page attributes

Post 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.
User avatar
velden
Dev Team Member
Dev Team Member
Posts: 3497
Joined: Mon Nov 28, 2011 9:29 am

Re: how to create more page attributes

Post 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.
User avatar
Dr.CSS
Moderator
Moderator
Posts: 12711
Joined: Thu Mar 09, 2006 5:32 am

Re: how to create more page attributes

Post 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...
psy
Power Poster
Power Poster
Posts: 463
Joined: Sat Jan 22, 2005 11:19 am

Re: how to create more page attributes

Post 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...
Locked

Return to “The Lounge”