Dynamic template include
| From: | Mike Carter | Date: | Mon, 10 Mar 2003 14:09:22 +0000 |
| Subject: | Dynamic template include | ||
| Groups: | php.smarty.general | ||
| Request: | Send a blank email to php-smarty-general+get-8528@lists.php.net to get a copy of this message | ||
Hi,
I've just installed the latest RC of Smarty hoping it may solve my problem,
but it appears not.
I have a template which gets three variables set. These variables are then
used to build up a directory path & filename to a sub-template which has to
be included.
The three variables are: $book, $chapter, $section. I tried using the
backticks as mentioned in a post in this mailing list archive - no change.
Here's my smarty include command within the template:-
{Include
File="web/MyLibrary/$book/chapter$chapter/CH$
chapter$section.tpl"}
In the Smarty error output to the browser it appears that most of the
file="" attribute is built correctly. However the filename extension gets
ommitted '.tpl'.
Warning: Smarty error: unable to read template resource:
"web/MyLibrary/greenbook/chapter33/CH332" in
c:\php4\pear\Smarty\Smarty.class.php on line 1042
Is the extension being interpreted by Smarty as an array element or
something? I'm stuck - maybe some sort of string concatenation can solve
this problem spread over a couple of Smarty commands?
Explinations welcome!! :-) Thanks,
--
Mike Carter [web developer]
tel: 01925 758229 // fax: 01925 758023 // web: www.koa.uk.com
This message is confidential.
Unless you are the named addressee or their delegated representative you may
not use, disclose, or copy the contents of the e-mail. If you are not the
named addressee please notify the sender immediately and delete the material
from your computer. Any views or opinions contained in this e-mail are
solely those of the author unless expressly stated otherwise
________________________________________________________________________
This e-mail has been scanned for all viruses by Star Internet. The
service is powered by MessageLabs. For more information on a proactive
anti-virus service working around the clock, around the globe, visit:
http://www.star.net.uk
________________________________________________________________________