[Solved] How to Make Global Content Blocks Dynamic?

For questions and problems with the CMS core. This board is NOT for any 3rd party modules, addons, PHP scripts or anything NOT distributed with the CMS made simple package itself.
Post Reply
applejack
Power Poster
Power Poster
Posts: 1014
Joined: Fri Mar 30, 2007 2:28 am

[Solved] How to Make Global Content Blocks Dynamic?

Post by applejack »

Hi

I am trying to create the reference to global content blocks on the fly using the menu manger to get the parent name of the page i.e.

{global_content name="{menu template='parent' start_level='2' number_of_levels='1'}"}

but it give a Smarty error.

If anyone knows how to generate global content block references dynamically please let me know as this would be very useful for cutting down on the number of templates required.

If anyone knows how to pass Smarty values to Javascript variables in a template then I might be able to use that.

Thanks in advance.
Last edited by applejack on Tue Feb 05, 2008 11:36 am, edited 1 time in total.

Website Design & Production
http://www.applejack.co.uk
calguy1000
Support Guru
Support Guru
Posts: 8169
Joined: Tue Oct 19, 2004 6:44 pm

Re: How to Make Global Content Blocks Dynamic?

Post by calguy1000 »

You can't nest { and } things in smarty calls.

look at http://smarty.php.net/manual/en

But other than that:

1) Install the CGSimpleSmarty module

2) {global_content name="$cgsimple->get_parent_alias()"}
Follow me on twitter
Please post system information from "Extensions >> System Information" (there is a bbcode option) on all posts asking for assistance.
--------------------
If you can't bother explaining your problem well, you shouldn't expect much in the way of assistance.
applejack
Power Poster
Power Poster
Posts: 1014
Joined: Fri Mar 30, 2007 2:28 am

Re: How to Make Global Content Blocks Dynamic?

Post by applejack »

Which is why {global_content name="$cgsimple->get_parent_alias()"} also doesn't work as the call to cgsimple also needs to be surrounded by Smarty tags {$cgsimple->get_parent_alias()}

C'est la vie.

Website Design & Production
http://www.applejack.co.uk
alby

Re: How to Make Global Content Blocks Dynamic?

Post by alby »

applejack wrote: Which is why {global_content name="$cgsimple->get_parent_alias()"} also doesn't work as the call to cgsimple also needs to be surrounded by Smarty tags {$cgsimple->get_parent_alias()}
No double {}, {$cgsimple->get_parent_alias()} it's correct

If {global_content name="$cgsimple->get_parent_alias()"} doesn't work (sometimes " don't work) try without (") or with backtick (`) sintax:
{global_content name=$cgsimple->get_parent_alias()}
{global_content name=`$cgsimple->get_parent_alias()`}

Alby
applejack
Power Poster
Power Poster
Posts: 1014
Joined: Fri Mar 30, 2007 2:28 am

Re: How to Make Global Content Blocks Dynamic?

Post by applejack »

Alby

Thanks very much for that worked without the quotes.

Website Design & Production
http://www.applejack.co.uk
Post Reply

Return to “CMSMS Core”