Re: Using strings as template resources
| From: | Ralph Meijer | Date: | Wed, 09 Jan 2002 17:00:25 +0000 |
| Subject: | Re: Using strings as template resources | ||
| References: | 1 | Groups: | php.smarty.general |
| Request: | Send a blank email to php-smarty-general+get-2508@lists.php.net to get a copy of this message | ||
Hi,
Just as you can write a resource handler to get your templates from
a database, ldap or somewhere else, you could write one that reads from
a string or array of strings where the key is the 'name' of your template.
So if you would have the text of the template in $template_strings["submitted"]
you could include it by using {include file="string:submitted"} and
write a resource handler for 'string' called get_string_template() with
register_resource('string', 'get_string_template');
Hope this helps,
Greetz,
Ralphm
On Wed, Jan 09, 2002 at 04:46:13PM +0000, Peter Bowyer wrote:
> Yes I have read the documentation, and cannot see any way to do what I want :-)
>
> I'm building a CMS using Smarty, and the articles will contain Smarty
> custom functions. Now, when the article is being written I want to have
> the ability to preview it. As the content's in a textarea, the template's
> contents is going to be passed as a string. Without writing this string to
> a temporary file and passing that to a resource function, how can I get the
> string to be treated as a template and the custom functions to be interpreted?
>
> Thanks,
> Peter.
>
> --oOo--
> Narrow Gauge on the web - photos, directory and forums!
> http://www.narrow-gauge.co.uk
> --oOo--
> Peter's web page - Scottish narrow gauge in 009
> http://members.aol.com/reywob/
> --oOo--
>
>
> ---
> You are currently subscribed to smarty as: smarty@ralphm.ik.nu
> To unsubscribe send a blank email to $subst('Email.Unsub')
> Visit Smarty's homepage at
> http://www.phpinsider.com/php/code/Smarty/
--
Groetjes, ,-----------------------------------------------------.
| ,.. en nou moet ik ophangen, d'r komt een bocht aan. |
Ralphm `------------------------------------------------------'