Pomoc - Szukaj - Użytkownicy - Kalendarz
Pełna wersja: smarty - 'Unable to load template file'
Forum PHP.pl > Forum > PHP
misty
hej, zaczynam dopiero swoja przygode ze smarty. sciagnelam najnowszego z oficjalnej strony. utworzylam projekty 'smarty_test'.
w nim utworzylam katalog:

smarty (w nim podkatalogi config, plugins, templates, templates_c oraz skopiowalam tu katalog libs ze smartego. czyli mam tu jeszcze: plugins, sysplugins, Smarty.class.php, debug.tpl)

poza katalogiem utworzylam plik index.php:

  1. <?php
  2.  
  3. require('./smarty/Smarty.class.php');
  4.  
  5. $tpl = new Smarty;
  6. $tpl -> template_dir = './templates/';
  7. $tpl -> compile_dir = './templates_c/';
  8.  
  9. $tpl -> assign('data', date('d.m.Y'));
  10. $tpl -> display('test.tpl');
  11.  
  12. ?>


zas w katalogu template utworzylam plik test.tpl. Jednak gdy wchodze na strone: http://localhost/smarty_test/index.php

dostaje err:
Fatal error: Uncaught exception 'SmartyException' with message 'Unable to load template file 'test.tpl'' in C:\wamp\www\smarty_test\smarty\sysplugins\smarty_internal_template.php:162 Stack trace: #0 C:\wamp\www\smarty_test\smarty\sysplugins\smarty_internal_template.php(537): Smarty_Internal_Template->isExisting(true) #1 C:\wamp\www\smarty_test\smarty\Smarty.class.php(335): Smarty_Internal_Template->getRenderedTemplate() #2 C:\wamp\www\smarty_test\smarty\Smarty.class.php(379): Smarty->fetch('test.tpl', NULL, NULL, NULL, true) #3 C:\wamp\www\smarty_test\index.php(10): Smarty->display('test.tpl') #4 {main} thrown in C:\wamp\www\smarty_test\smarty\sysplugins\smarty_internal_template.php on line 162

nie chce mi zaladowac tego tpl. czy ktos z Was wie o co chodzi?? pytalam google ale nie znalazlam odp..
rootpak
Cytat(misty @ 17.11.2010, 11:51:25 ) *
poza katalogiem utworzylam plik index.php...

zas w katalogu template utworzylam plik test.tpl


index.php nie widzi test.tpl - sprawdz jeszcze raz polozenie plikow.
nospor
skoro wszystko masz w katalogu smarty to tak ma byc:
  1. $tpl -> template_dir = './smarty/templates/';
  2. $tpl -> compile_dir = './smarty/templates_c/';
misty
dzieki
To jest wersja lo-fi głównej zawartości. Aby zobaczyć pełną wersję z większą zawartością, obrazkami i formatowaniem proszę kliknij tutaj.
Invision Power Board © 2001-2025 Invision Power Services, Inc.