So the idea here is; keep a single template but allow custom content to appear via smarty tags that are specified in the "Smarty data..." entry on the "Logic" tab of your content page editor. For example we want to put some form data on a page. One might create a new template and put the smarty tag after the content definition
Code: Select all
...{$main_content nocache}...
{FormBuilder form='my-form'}...
So here is how I approached this problem.
First you need to set up a User Defined Tag:
name: dynamic_smarty
Code:
Code: Select all
$smarty->display('eval:'.$params['smarty_data']);
So let say our content is defined by:
Code: Select all
{$main_content nocache}
Code: Select all
{if isset($customcontent)}
{dynamic_smarty smarty_data="$customcontent"}
{/if}
In your page content->Logic->"Smarty data or logic that is specific to this page:"
Place the following code:
Code: Select all
{$customcontent = "{FormBuilder form='my-form'}"}
{share_data scope=parent vars='customcontent' scope=global}
I hope this helps people realise just how smart smarty tags are.
It would also be nice if this example was put into the documentation of User Defined Tags.