content shuffling across templates.

From: Date: Sun, 18 Apr 2004 08:05:34 +0000
Subject: content shuffling across templates.
Groups: php.smarty.dev 
Request: Send a blank email to php-smarty-dev+get-2293@lists.php.net to get a copy of this message
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

« previous php.smarty.dev (#2293) next »