[Smarty] Kan geen tags aanmaken.
mijn PHP code
Code (php)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
2
3
4
5
6
7
8
9
10
11
12
13
14
15
<?php
// put full path to Smarty.class.php
require('/usr/lib/php5/Smarty/Smarty.class.php');
$smarty = new Smarty();
$smarty->template_dir = '/var/www/smarty/templates';
$smarty->compile_dir = '/var/www/smarty/templates_c';
$smarty->cache_dir = '/var/www/smarty/cache';
$smarty->config_dir = '/var/www/smarty/configs';
$smarty->assign('titel', 'Dit is de titel van de webpagina');
$smarty->assign('content', 'Dit is content');
$smarty->display('test/index.tpl');
?>
// put full path to Smarty.class.php
require('/usr/lib/php5/Smarty/Smarty.class.php');
$smarty = new Smarty();
$smarty->template_dir = '/var/www/smarty/templates';
$smarty->compile_dir = '/var/www/smarty/templates_c';
$smarty->cache_dir = '/var/www/smarty/cache';
$smarty->config_dir = '/var/www/smarty/configs';
$smarty->assign('titel', 'Dit is de titel van de webpagina');
$smarty->assign('content', 'Dit is content');
$smarty->display('test/index.tpl');
?>
de HTML
En de melding die ik krijg
Code (php)
1
Fatal error: Smarty error: [in test/index.tpl line 3]: syntax error: unrecognized tag 'titel' (Smarty_Compiler.class.php, line 590) in /usr/lib/php5/Smarty/Smarty.class.php on line 1092
Ik snap niet wat het probleem is. Alle directories zijn aangemaakt en zijn toegankelijk voor Smarty. Hij kan de tag niet aanmaken, als ik geen tags in de HTML hjeb staan werkt het wel gewoon dus het ligt niet aan de rechten op de mappen.
In de Smarty handleiding stond hier ook al niets over en google helpt ook niet echt. Ik heb ook geen plugins of iets geinstalleerd. Zelfs de basis tag werkt niet ($Smarty->assign('name', 'Ned'); )
Iemand een idee hoe ik dit oplos?
Gewijzigd op 01/01/1970 01:00:00 door Jurgen assaasas
edit: een plugin (smarty functie) gebruik je wel op die manier.
Gewijzigd op 01/01/1970 01:00:00 door Terence Hersbach
Terence schreef op 05.06.2008 14:59:
je assigned een variable, in smarty gebruik je die als {$titel}
edit: een plugin (smarty functie) gebruik je wel op die manier.
edit: een plugin (smarty functie) gebruik je wel op die manier.
Ok dankje, ik vond het al vreemd dat het niet werkte.
Docs lezen? Dat heeft bij mij met smarty zeker geholpen, vooral bij for(each), dat was behoorlijk lastig. Verder is het leuk.