Smarty unable to load tpl file

  • Beste


    ik ben nu net begonnen met smarty en ik stoot al op een fout.
    "Fatal error: Uncaught exception 'SmartyException' with message 'Unable to load template file 'header.tpl'' in C:\Users\Willem en Alexander\Documents\aaa willem\scripts\xtremewar\includes\libs\sysplugins\smarty_internal_templatebase.php:127 Stack trace: #0 C:\Users\Willem en Alexander\Documents\aaa willem\scripts\xtremewar\includes\libs\sysplugins\smarty_internal_templatebase.php(374): Smarty_Internal_TemplateBase->fetch('header.tpl', NULL, NULL, NULL, true) #1 C:\Users\Willem en Alexander\Documents\aaa willem\scripts\xtremewar\index.php(6): Smarty_Internal_TemplateBase->display('header.tpl') #2 {main} thrown in C:\Users\Willem en Alexander\Documents\aaa willem\scripts\xtremewar\includes\libs\sysplugins\smarty_internal_templatebase.php on line 127"



    Dit is mijn code
    index.php:

    PHP
    <?php	include("includes/core.class.php");		$smarty = new Page;		$smarty->display("header.tpl");	$smarty->display("index.tpl");	$smarty->display("footer.tpl");?>



    core.class.php

    PHP
    <?php	include("libs/Smarty.class.php");
    	class Page extends Smarty	{				public function __construct()		{			parent:: __construct();						$this->debugging = true; // DEBUGGING STAAT AAN						$this->template_dir = "smarty_templates";			$this->compile_dir = "smarty_templates_c";			$this->config_dir = "smarty_configs";			$this->cache_dir = "smarty_cache";					}	}?>



    De smarty mapjes (template, compile, config, cache) staan in dezelfde map als de core file


    Wie kan mij helpen?


    Bedankt :)


    Om een of andere reden wordt mijn code ook altijd achter elkaar weergegeven op deze site?

  • Opgelost


    @Ferhat: Die mapjes moeten niet in de root staan maar omdat mijn bestand index.php wel in de root map staat moest ik het volgende doen:

    PHP
    $this->template_dir = "includes/smarty_templates";


    Idem voor 3 andere mappen.


    Ik was verward omdat het core bestand ook in de map includes staat. Ik dacht dat het niet nodig was om er includes/ voor te zetten

  • het lijkt er op dat hij de pad naar het bestand niet krijgt kijk even of dit goed staat


    Code
    $smarty->setTemplateDir('/web/www.example.com/smarty/templates');
    $smarty->setCompileDir('/web/www.example.com/smarty/templates_c');
    $smarty->setCacheDir('/web/www.example.com/smarty/cache');
    $smarty->setConfigDir('/web/www.example.com/smarty/configs');

Participate now!

Heb je nog geen account? Registreer je nu en word deel van onze community!