|
Smarty
WARNING: All discussion is moving to https://reddit.com/r/smarty, please go there! This forum will be closing soon. |
|
View previous topic :: View next topic |
Author |
Message |
vary88 Smarty n00b
Joined: 17 Nov 2011 Posts: 3
|
Posted: Thu Nov 17, 2011 4:47 pm Post subject: Whats the problem with this smarty code? |
|
|
include_once("../smarty/libs/Smarty.class.php");
$smarty = new smarty();
$smarty->setTemplateDir('templates/');
$smarty->setCompileDir('templates/z_complied');
$smarty->setCacheDir('templates/z_cached');
$a = "something";
$smarty->assign('sy', $a);
--- and then in the html:
<div>
{$sy}
</div>
------
the output is "$sy" and not the "something". Why? |
|
Back to top |
|
mohrt Administrator
Joined: 16 Apr 2003 Posts: 7368 Location: Lincoln Nebraska, USA
|
Posted: Thu Nov 17, 2011 5:18 pm Post subject: |
|
|
what is the rest of the code? do you have
$smarty->display('index.tpl');
And that is the source of the index.tpl file? is the output just $sy, or <div>{$sy}</div> literally, or something else? (view source of browser if looking at it in a browser) |
|
Back to top |
|
vary88 Smarty n00b
Joined: 17 Nov 2011 Posts: 3
|
Posted: Thu Nov 17, 2011 7:09 pm Post subject: this is my code |
|
|
----index.php:
<?
include_once("../smarty/libs/Smarty.class.php");
$smarty = new smarty();
$smarty->setTemplateDir('templates/');
$smarty->setCompileDir('templates/z_complied');
$smarty->setCacheDir('templates/z_cached');
$a = "szoveg";
$smarty->assign('het', 'eztfogja odaadni');
include_once("head.tpl");
include_once("page.tpl");
---------page.tpl (head.tpl is not interest:
<body onload="load()">
<div id="idcont" class="container">
<div class="menu">
menü
</div>
<div class="content">
<div id="idhead" class="head">
<div class="little">
<div class="but"><button> <- </button></div>
<div id="ide" class="ide">
{$het}
</div>
<div class="but"><button> -> </button></div>
</div>
</div>
<div class="tables">
<table>
<tr class="tableshead">
<td>Hétfő</td>
<td>Kedd</td>
<td>Szerda</td>
<td>Csütörtök</td>
<td>Péntek</td>
<td>Szombat</td>
<td>Vasárnap</td>
</tr>
<tr class="tablescontent">
<td>1</td>
<td>2</td>
<td>3</td>
<td>4</td>
<td>5</td>
<td>6</td>
<td>7</td>
</tr>
</table>
</div>
</div>
</div>
</body>
</html> |
|
Back to top |
|
mohrt Administrator
Joined: 16 Apr 2003 Posts: 7368 Location: Lincoln Nebraska, USA
|
Posted: Thu Nov 17, 2011 7:16 pm Post subject: |
|
|
I see a problem:
Code: | include_once("head.tpl");
include_once("page.tpl"); |
That just includes the file like a PHP script. You need to use $smarty->display(). |
|
Back to top |
|
vary88 Smarty n00b
Joined: 17 Nov 2011 Posts: 3
|
Posted: Thu Nov 17, 2011 7:40 pm Post subject: :) |
|
|
ohhh thanky you, yeah it was my bad !!!!!!! Sure, sorry for the donkey quest Very thank you |
|
Back to top |
|
|
|
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
|