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.
[Solved] How to Make Global Content Blocks Dynamic?
[Solved] How to Make Global Content Blocks Dynamic?
Last edited by applejack on Tue Feb 05, 2008 11:36 am, edited 1 time in total.
-
- Support Guru
- Posts: 8169
- Joined: Tue Oct 19, 2004 6:44 pm
Re: How to Make Global Content Blocks Dynamic?
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()"}
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.
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.
Re: How to Make Global Content Blocks Dynamic?
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.
C'est la vie.
Re: How to Make Global Content Blocks Dynamic?
No double {}, {$cgsimple->get_parent_alias()} it's correctapplejack 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()}
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
Re: How to Make Global Content Blocks Dynamic?
Alby
Thanks very much for that worked without the quotes.
Thanks very much for that worked without the quotes.