SitePoint Sponsor |
|
User Tag List
Results 1 to 6 of 6
Thread: Smarty question
-
Sep 2, 2007, 08:44 #1
- Join Date
- Oct 2005
- Location
- London
- Posts
- 1,678
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
Smarty question
Ive just started using smarty. I have a question about it.
Im currently using a header template to put the header content in each page. So if i have a script called registration.php and an associated template called registration.tpl.html i include the header as usual:
PHP Code:{include file="header.tpl.html"}
How do i include files such as header.tpl.hml and also make the logic within them get output?
-
Sep 2, 2007, 09:43 #2
- Join Date
- Dec 2002
- Location
- Canada
- Posts
- 2,476
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
I am no Smarty expert but it looks like the {include_php} tag may work for you, or change your logic to be within the header template or already "solved" before displaying registration.tpl.html...
AskItOnline.com - Need answers? Ask it online.
Create powerful online surveys with ease in minutes!
Sign up for your FREE account today!
Follow us on Twitter
-
Sep 2, 2007, 15:59 #3
- Join Date
- Aug 2007
- Location
- edge of nowhere
- Posts
- 74
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
You need to also include header.php into registration.php for the template to work properly.
Recode your header.php in such a way that you can include it everywhere you are outputing your header and you should be fine.Programming boils down to three things: fast, good and cheap.
Please pick two.
-
Sep 2, 2007, 17:47 #4
- Join Date
- Nov 2004
- Location
- Lincoln Nebraska
- Posts
- 1,161
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
I try to stay away from too much logic in the templates in Smarty, not that it's a bad thing, but our designer for instance, is no programmer (an excellent designer, but very graphics oriented). Too many loops extensions and if statements might make her head explode. Having said that, if you don't mind using them, smarty has ways of adding just about any logic you need, within the template. Just go through the documentation. It's not bad.
-
Sep 2, 2007, 17:58 #5
- Join Date
- Dec 2002
- Location
- Canada
- Posts
- 2,476
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
AskItOnline.com - Need answers? Ask it online.
Create powerful online surveys with ease in minutes!
Sign up for your FREE account today!
Follow us on Twitter
-
Sep 10, 2007, 12:31 #6
- Join Date
- Oct 2005
- Location
- London
- Posts
- 1,678
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
i still cannot get this to work....i have a template called cateogry.tpl.html and an associated code called category.php. If i include category.php in my results.php script and put an {include file="cateogry.tpl.html"} in results.tpl.html all i get is the cateogory output after the results tamplate has finished being parsed. I want the categories to appear in a div in the left ( where im putting the include file code in results.tpl.html) but it doesnt work.
Im at a loss. If you cant include logic and templates and embed them in other templates and have them work as if they were running outside of another template then smarty is not all its cut out to be
Bookmarks