|
Smarty
WARNING: All discussion is moving to https://reddit.com/r/smarty, please go there! This forum will be closing soon. |
|
View previous topic :: View next topic |
Author |
Message |
Jeremy- Smarty Rookie
Joined: 11 Feb 2005 Posts: 16
|
Posted: Thu May 19, 2005 7:53 am Post subject: Replace bits of code in template for cache.... |
|
|
Is it possible to replace content on the fly within the Smarty .tpl file, and then have the result cached?
For example, let's say I have my own mini-template engine within the framework I am using Smarty for... I have an easy method set up for users to create input fields that allow dynamic class change if for some reason the posted content is invalid.
The input is defined in the .tpl file as such:
<!--input:password:: accesskey:p, label:lang->password, name:password, id:password-->
That gets parsed through a function and is returned as a new variable. So, is there a way to take all the <!--input... within the template and replace it with the actual returned variable for the cache file? I know I could solve a lot of headache by making the input itself a variable and configuring it's attributes in framework source, but that defeats the point of what abilities I'd like to give to the end user administrator.
--------
If what I posted sounds too complicated, I'll say it like this. Is there a way I could replace the text "<!--hey--> in the .tpl file with the actual text "hey this is some text" in the cache file. I hope that makes sense...
Any advice what-so-ever is greatly appreciated. |
|
Back to top |
|
boots Administrator
Joined: 16 Apr 2003 Posts: 5611 Location: Toronto, Canada
|
Posted: Thu May 19, 2005 11:10 pm Post subject: |
|
|
I'm not sure I follow entirely but it seems like you should either consider using a plugin function that you register as non-caching or otherwise either a compiler-plugin or a prefilter.
Check them out and then ask if you have specific questions. |
|
Back to top |
|
Jeremy- Smarty Rookie
Joined: 11 Feb 2005 Posts: 16
|
Posted: Sun May 22, 2005 8:13 pm Post subject: |
|
|
Thanks, I have it working now using a custom function. Once it's more developed, I'll look into making it available to anyone else that needs it. |
|
Back to top |
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|