Page 1 of 1

using extra page attributes

Posted: Wed Aug 20, 2008 3:27 pm
by markS
Hello,
       Firstly I'd like to thank all the contributors to this cms, it has proved to be a fantastic system for me.  I really appreciate all the hard work everyone has put into this, hopefully I'll be able to contribute something back before too long.

I've just installed v1.4.1 and I have a question regarding the new  'Extra Page Attributes'.

I found this post http://forum.cmsmadesimple.org/index.php/topic,23777.msg115672.html#msg115672, that explains how to use them in the context of the menu manager: $node->extra1 

That seems clear enough, but I'd like to use those values within a UDT but I can't seem to expose the values within my tag, how should I reference them(I'm trying to use the value in extra1 to restrict the view of certain pages)?  Do I need a particular module installed?

Thanks in advance for any help you can give me.

Mark.

Re: using extra page attributes

Posted: Sat Sep 20, 2008 7:23 pm
by Augustas
In order to access extra1/ extra2 / extra3 in UDT you can do this:
1) install CGSimpleSmarty module
2) in UDT use this code:

Code: Select all

global $gCms;
$cgsimple = $smarty->get_template_vars('cgsimple');
$extra1 = $cgsimple->get_page_content($page_alias, 'extra1');
Here, "$page_alias" is the ID or Alias of the page.

If you don't want to install CGSimpleSmarty module, you can at least look at PHP code of this module in order to see an example how the "extra1" is retrieved.

[solved] Re: using extra page attributes

Posted: Thu Sep 25, 2008 9:49 am
by markS
Many thanks for getting back to me on this.  I eventually achieved what I was trying to do with a different technique, but I'm grateful that you've explained this to me.

Maybe I should dig around in the source some more to get a better understanding of what's going on under the hood...

Thanks again.

Mark.

Re: using extra page attributes

Posted: Wed Oct 08, 2008 7:14 pm
by SideshowBob
Hi,

I used this UDT with the CGSimpleSmarty module installed.

Code: Select all

global $gCms;
$page_alias = $smarty->get_template_vars('page_alias');
$cgsimple = $smarty->get_template_vars('cgsimple');
echo $cgsimple->get_page_content($page_alias, 'extra1');
Bob