Smarty Forum Index Smarty
WARNING: All discussion is moving to https://reddit.com/r/smarty, please go there! This forum will be closing soon.

Problem with include

 
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    Smarty Forum Index -> General
View previous topic :: View next topic  
Author Message
aarnus
Smarty Rookie


Joined: 07 Aug 2004
Posts: 6

PostPosted: Sat Aug 07, 2004 2:07 pm    Post subject: Problem with include Reply with quote

Hi guys,

I am new at Smarty. I use Smarty template for travel booking engine. I have a problem with currency; i have to convert EURO to our slovenian TOLAR. I would like to include variable $youramount from PHP file which grabs current slovenian currency. How can i call this variable in my template? I have like this but it dosn't work?
{include file="/usr/odpotuj/weather/skin/templates/c_convert/exchange.php"}

{math equation="GetPreis * Tolar" GetPreis=$CHARTERTRIPS[liste]->getPreis() Tolar=$youramount}


Thanx for helping me,
Best regards from Slovenia
Jure Arnus
Back to top
View user's profile Send private message
messju
Administrator


Joined: 16 Apr 2003
Posts: 3336
Location: Oldenburg, Germany

PostPosted: Sat Aug 07, 2004 6:14 pm    Post subject: Reply with quote

to make the variable accessible in your template you have to assign it
form the php-script, before you call display():

include("/usr/odpotuj/weather/skin/templates/c_convert/exchange.php");
$smarty->assign('youramount', $youramout)
Back to top
View user's profile Send private message Send e-mail Visit poster's website
aarnus
Smarty Rookie


Joined: 07 Aug 2004
Posts: 6

PostPosted: Sun Aug 08, 2004 8:02 am    Post subject: Thanx Reply with quote

Thanx for your reply.
Then this is the right code?
{include file="/c_convert/exchange.php"}
{$smarty->assign('youramount',$youramout)}
{math equation="GetPreis * Tolar" GetPreis=$CHARTERTRIPS[liste]->getPreis() Tolar=$youramount}

Second question:
I have also a problem with how to include my regions and airport list - i have it in PHP file. Now is calling it from server but i would like to have it called from my own php - which is the same on as it on server excepct my is translated into our language.
This is the code : (select_rw.plp)

<select name="hmi" size="8" multiple {if $style ne ""}style="{$style}"{/if} class="input">
{html_options options=$AIRLIST selected=$SEARCH->getItem('hmi')}</select>

Thanx once again for all your help!
Jure
Back to top
View user's profile Send private message
messju
Administrator


Joined: 16 Apr 2003
Posts: 3336
Location: Oldenburg, Germany

PostPosted: Sun Aug 08, 2004 7:22 pm    Post subject: Re: Thanx Reply with quote

aarnus wrote:
Thanx for your reply.
Then this is the right code?
{include file="/c_convert/exchange.php"}
{$smarty->assign('youramount',$youramout)}
{math equation="GetPreis * Tolar" GetPreis=$CHARTERTRIPS[liste]->getPreis() Tolar=$youramount}


no, the first two lines are php and should be in a php-script, not in a smarty-template.
Back to top
View user's profile Send private message Send e-mail Visit poster's website
aarnus
Smarty Rookie


Joined: 07 Aug 2004
Posts: 6

PostPosted: Sun Aug 08, 2004 7:30 pm    Post subject: Reply with quote

Thanx for first answer. I'll try.

Is it possible if you could help me with second question?
Thanx,
Jure
Back to top
View user's profile Send private message
messju
Administrator


Joined: 16 Apr 2003
Posts: 3336
Location: Oldenburg, Germany

PostPosted: Sun Aug 08, 2004 8:27 pm    Post subject: Reply with quote

aarnus wrote:
Is it possible if you could help me with second question?


i would have answered, of course. but i don't have the slightest idea what you want, sorry.
Back to top
View user's profile Send private message Send e-mail Visit poster's website
aarnus
Smarty Rookie


Joined: 07 Aug 2004
Posts: 6

PostPosted: Sun Aug 08, 2004 8:35 pm    Post subject: Reply with quote

Hi,

Well my second question is how to include outside php file into smarty template file. I have select_rw.tpl file:
<select name="hmi" size="8" multiple {if $style ne ""}style="{$style}"{/if} class="input">
{html_options options=$AIRLIST selected=$SEARCH->getItem('hmi')}</select>

The problem is that i would like to use instead of server's (i run travel booking engine) php file called tibet_regions.php where are written all the regions in the world and i have translated it into slovenian language.
Is it possible to somehow exclude server's php file and use on local server php file which i have?
Hope you understand me,
Jure
Back to top
View user's profile Send private message
apz
Smarty Rookie


Joined: 07 Aug 2004
Posts: 6
Location: iran - yazd

PostPosted: Mon Aug 09, 2004 5:55 am    Post subject: problem with tpl in tpl called ! Reply with quote

hi dear
i have a tpl file and i want to include another tpl file from it , it work .
but when i refresh page i only can see one of tpl file be included !!!

this is very important problem and if can not solve it , may be smarty alone .

included first tpl file is same as :
{* Smarty template *}
{include file="header.tpl" title="Page title..."}
{include file="logo.tpl"}
<div class="container">
[ pagey stuff ]
</div>
{include file="footer.tpl"}

you test your own code and see problem in it !!!
help to me ! or help to smarty !
thx
Back to top
View user's profile Send private message Visit poster's website Yahoo Messenger
messju
Administrator


Joined: 16 Apr 2003
Posts: 3336
Location: Oldenburg, Germany

PostPosted: Mon Aug 09, 2004 6:18 am    Post subject: Re: problem with tpl in tpl called ! Reply with quote

@apz: it is enough to ask a question *ONCE*. if somebody can help you, I'm sure he/she will. There is no need to spam the board.
Back to top
View user's profile Send private message Send e-mail Visit poster's website
aarnus
Smarty Rookie


Joined: 07 Aug 2004
Posts: 6

PostPosted: Mon Aug 09, 2004 7:16 am    Post subject: Reply with quote

Hi,

Do you have perhaps answer for me?
Thanx,
Jure
Back to top
View user's profile Send private message
bendeg
Smarty Rookie


Joined: 08 Feb 2005
Posts: 7

PostPosted: Tue Feb 08, 2005 2:41 pm    Post subject: Reply with quote

Hi all,

Got include problems too here :

{*Smarty main template*}

{config_load file="test.conf"}
{include file = "header.tpl"}
{include file = "left_column.tpl"}
{if $selection == 0}
{include file = "accueil.tpl"}
{else}
{if $col == 1}
{include file = "liste_groupe.tpl"}
{else}
{include file = "details_groupe.tpl"}
{/if}
{/if}
{include file = "footer.tpl"}


ALL WORKS FINE WITH NETSCAPE OR FIREFOX.

WITH INTERNET EXPLORER 6 : JUST BEFORE EACH {include...} (in HTML output), THERE IS A SPECIAL CARACTER THAT ACTS LIKE <BR>, BUT IT'S NOT A <BR> !!!

Any idea ?!?
[/quote]
?>[/php]
Back to top
View user's profile Send private message Send e-mail MSN Messenger
Display posts from previous:   
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    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