|
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 |
mankyd Smarty Regular
Joined: 04 May 2006 Posts: 92 Location: Boston MA
|
Posted: Mon Jan 08, 2007 6:10 pm Post subject: Graceful Error Handling (i.e. when missing plugins) |
|
|
I first want to say that I am loving Smarty and am in the process of a creating what I think will be a great tool that would not otherwise be possible with out it. Thanks to the Smarty team!
Anyways, the tool I am developing is a modular CMS of sorts. At run time, my code loads in a bunch of plugins (one of which is a Smarty based template engine) and those plugins in turn work their magic. Some of those plugins contain within themselves Smarty plugins. One such example is my 'comments' plugin which registers a block plugin with Smarty and loads in comments into the appropriate place and format in the template.
Here's where the problem lies. If the template contains the {comments}{/commments} tag and the plugin is loaded, everything works just peachy. However, if my comments plugin is not loaded (and thus the smarty plugin was not loaded) it fails pretty hard.
I would love it if there was a way to make smarty simply ignore the unrecognized tags. Even better, if it detected it was a block function, it would hide all the html that occurs between the unrecognized tags.
At the very least, I am hoping there is a way to customize the error output and continue on with the script output. Anyone have any ideas?
example template:
Code: |
<!-- here is the top part of the page -->
<!-- various content and smarty tags go up here -->
{comments}
<!-- here is a custom block plugin that loops to display comments -->
<!-- it works fine if the comments plugin is loaded, but fails hard if not -->
{/comments}
<!-- more stuff after the comments -->
|
|
|
Back to top |
|
mankyd Smarty Regular
Joined: 04 May 2006 Posts: 92 Location: Boston MA
|
Posted: Tue Jan 09, 2007 11:08 pm Post subject: |
|
|
So, I think I've figured out how to do this with a prefilter plugin, assuming two things. First, Is there a way to get a list of registered plugins and their type? Second, is there an appropriate way to clear the compile_dir (as opposed to the cache_dir)?
I suppose I can hack through Smarty.class.php to answer the first question, but didn't know if someone else knew the right way to do this. Any help would be appreciated. Thanks! |
|
Back to top |
|
Pap Smarty Regular
Joined: 21 Jun 2006 Posts: 69 Location: Denver, CO
|
|
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
|