Re: different template paths
| From: | Ralph Meijer | Date: | Thu, 19 Jul 2001 15:20:21 +0000 |
| Subject: | Re: different template paths | ||
| References: | 1 | Groups: | php.smarty.general |
| Request: | Send a blank email to php-smarty-general+get-1212@lists.php.net to get a copy of this message | ||
On Thu, Jul 19, 2001 at 01:23:29PM +0200, Marc Logemann wrote:
> Hi,
>
> i dont think that would help, the thing is, we need a search-path,
> and this search path could be an array of several template path.
>
> Of course you can overide the actual template path, for different
> scripts, but the include() problem still exists, because you cant
> overide the template path within the parsing of a document.
>
> I like the idea of Monte below....
>
My problem maybe is of another kind: I have a site with functionality
which can be represented in slightly different ways (layout and textual).
The idea is that the script uses templates by the same name from different
directories depending on via which affiliate partner a visitor is coming.
Dir layout is like this:
templates/$skin for overrides in layout and text
templates/default for all basic functionality
A template by the same name is first searched for in the first dir, and
if not found in the second.
(there are some more eleborate examples, but you get the idea)
At this moment I use the template library of PHPLIB for this purpose with
an altered file retrieval method.
By looking at the code this could be achieved by having a method (initially
no-op) which alters a relative template filename (functionality.tpl) to
something which includes the extra information (e.g. $skin:functionality.tpl
of something, the idea is that all dynamic information is in the resource
before processing it further).
After that you can use resource functions to do the actual searching.
The last part can be done which the current functionality as long as your
resources are static for all invocations. By adding a rewriting method
you can simulate this.
This method would be invoked at the beginning of _process_template as I
now see it. Maybe I could do a test implementation this weekend.
Another way of course is to write a template preprocessing function to alter
all include directives to include the correct information, but that's a bit
too much and I'd like to have the include directive as easy as possible.
Any thoughts?
Greetz,
Ralphm