Smarty Forum Index Smarty
The discussions here are for Smarty, a template engine for the PHP programming language.

missing FAQ answer

 
Post new topic   Reply to topic    Smarty Forum Index -> General
View previous topic :: View next topic  
Author Message
timo
Smarty n00b


Joined: 13 Mar 2006
Posts: 3

PostPosted: Mon Mar 13, 2006 6:42 am    Post subject: missing FAQ answer Reply with quote

How can I assign a variable in an include file, and make it visible to the main (including) template?

I was happy to find my question in the FAQ, but to my disapointment there was no answer. Can any1 help me out here, please?

I have a template that includes several other templates. These included templates contain variables received from php-scripts. The problem is that my nice zend shows me the output, but my browser leaves out the variables. Any1 know how I can make my browser spit it out right?

Thanks in advance,
Timo
Back to top
View user's profile Send private message
timo
Smarty n00b


Joined: 13 Mar 2006
Posts: 3

PostPosted: Tue Mar 14, 2006 6:06 am    Post subject: Reply with quote

Solved the problem myself. For any1 with the same problem:

the template can be included normally. Any variables given to this template can be assigned in the php script behind the original template. It is of course cleaner code to make a diffrent script for that and include it in the original script.

My problem turned out to be a wrong pathname Embarassed

Cheers,
Timo
Back to top
View user's profile Send private message
zikoh
Smarty n00b


Joined: 28 Mar 2006
Posts: 2

PostPosted: Tue Mar 28, 2006 4:43 pm    Post subject: could u give me ur source code? Reply with quote

i have a small code.
i have 3 templates file(1.tpl,2.tpl,3.tpl).inside the "1.tpl" have a var "{$var2}" call template '2.tpl', and in template '2.tpl' i have a var "{$var3}" call template '3.tpl'.
Now, how can i do that? i can't assign value for {$var2},{$var3}. i use smarty->fetch('2.tpl'),smarty->fetch('3.tpl') for call template inside is right?
Give me an answer,thanks.
Back to top
View user's profile Send private message
TGKnIght
Smarty Junkie


Joined: 07 Sep 2005
Posts: 580
Location: Philadelphia, PA

PostPosted: Tue Mar 28, 2006 6:54 pm    Post subject: Reply with quote

Code:

{include file=$var2}

_________________
Smarty site with one index.php controller file
Working with MySQL and Smarty
SmartyColumnSort
Custom Smarty Javascript Debug Template
Back to top
View user's profile Send private message Visit poster's website
zikoh
Smarty n00b


Joined: 28 Mar 2006
Posts: 2

PostPosted: Wed Mar 29, 2006 10:20 am    Post subject: Reply with quote

plz show me your code,i'm a newbie.so can't understand what you write.Thanks.
Back to top
View user's profile Send private message
innoflame
Smarty Rookie


Joined: 12 Jul 2011
Posts: 6

PostPosted: Sat Sep 10, 2011 2:32 pm    Post subject: need immidiatly Reply with quote

i also need to know the solution of this issue :/
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Smarty Forum Index -> General All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group
Protected by Anti-Spam ACP