View previous topic :: View next topic |
Author |
Message |
aarnus Smarty Rookie
Joined: 07 Aug 2004 Posts: 6
|
Posted: Sat Aug 07, 2004 2:07 pm Post subject: Problem with include |
|
|
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 |
|
messju Administrator
Joined: 16 Apr 2003 Posts: 3336 Location: Oldenburg, Germany
|
Posted: Sat Aug 07, 2004 6:14 pm Post subject: |
|
|
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 |
|
aarnus Smarty Rookie
Joined: 07 Aug 2004 Posts: 6
|
Posted: Sun Aug 08, 2004 8:02 am Post subject: Thanx |
|
|
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 |
|
messju Administrator
Joined: 16 Apr 2003 Posts: 3336 Location: Oldenburg, Germany
|
Posted: Sun Aug 08, 2004 7:22 pm Post subject: Re: Thanx |
|
|
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 |
|
aarnus Smarty Rookie
Joined: 07 Aug 2004 Posts: 6
|
Posted: Sun Aug 08, 2004 7:30 pm Post subject: |
|
|
Thanx for first answer. I'll try.
Is it possible if you could help me with second question?
Thanx,
Jure |
|
Back to top |
|
messju Administrator
Joined: 16 Apr 2003 Posts: 3336 Location: Oldenburg, Germany
|
Posted: Sun Aug 08, 2004 8:27 pm Post subject: |
|
|
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 |
|
aarnus Smarty Rookie
Joined: 07 Aug 2004 Posts: 6
|
Posted: Sun Aug 08, 2004 8:35 pm Post subject: |
|
|
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 |
|
apz Smarty Rookie
Joined: 07 Aug 2004 Posts: 6 Location: iran - yazd
|
Posted: Mon Aug 09, 2004 5:55 am Post subject: problem with tpl in tpl called ! |
|
|
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 |
|
messju Administrator
Joined: 16 Apr 2003 Posts: 3336 Location: Oldenburg, Germany
|
Posted: Mon Aug 09, 2004 6:18 am Post subject: Re: problem with tpl in tpl called ! |
|
|
@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 |
|
aarnus Smarty Rookie
Joined: 07 Aug 2004 Posts: 6
|
Posted: Mon Aug 09, 2004 7:16 am Post subject: |
|
|
Hi,
Do you have perhaps answer for me?
Thanx,
Jure |
|
Back to top |
|
bendeg Smarty Rookie
Joined: 08 Feb 2005 Posts: 7
|
Posted: Tue Feb 08, 2005 2:41 pm Post subject: |
|
|
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 |
|
|