content shuffling across templates.
Jason Hines <[email protected]>
| Newsgroups | gmane.comp.php.smarty.devel |
|---|---|
| Organization | devtwo |
| Message-ID | <[email protected]> |
Hi. I am working with a framework which uses Smarty in a nested fashion
similiar to this example:
Top.tpl
|- Sidebar.tpl
|- Navigation.tpl
|- Content.tpl
| `- Form.tpl
| |- TextInput.tpl
| |- TextInput.tpl
| `- SubmitInput.tpl
`- Copyright.tpl
Each template is handled by individual "nodes" (PHP) in a
heirarchy-style rendering. The Top.tpl is rendered last, which contains
the <head> and <body> tags in HTML.
My question is this. I am attempting to make it possible so that
templates can "push" a block on content to a designated area (such as
HEAD or BODY). I've been toying around with outputfilters and plugins
giving the ability for templates to do:
{resource id="someID" area="HEAD"}
<style>
// some style i want pushed to <head>
</style>
{/resource}
So this block function will assign the content to a static array.
So then in the Top.tpl, I do:
{outputresources area="HEAD"}
This function will print a "token" (md5($area)) in this place, and then
an outputfilter will str_replace() this token for the actual content.
This works, but is quirky in some cases (and quite expensive) - and I'm
wondering if others have attempted to do this same thing.
jason
--
Smarty Development Mailing List (http://smarty.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php