Salv Posted January 29, 2014 Report Share Posted January 29, 2014 Sveiciens! Vajadzīgs padoms. Kodu, kas izsauc Smarty bibliotēku ievietoju funkcijā (pirms tam viss strādāja kā vajag). Kas man vēl būtu jāpievieno, lai funkcija nostrādātu korekti? <?php //functions.php function call_smarty(){ require_once('../Smarty/Smarty.class.php'); $smarty = new Smarty(); $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'); } ?> //index.php <?php // put full path to Smarty.class.php require_once ('functions/functions.php'); call_smarty(); $smarty->display('views/header.tpl'); $smarty->display('views/sidebar.tpl'); $smarty->display('views/main.tpl'); $smarty->display('views/footer.tpl'); ?> Quote Link to comment Share on other sites More sharing options...
briedis Posted January 29, 2014 Report Share Posted January 29, 2014 function call_smarty(){ ... return $smarty; } $smarty = call_smarty(); $smarty->... Quote Link to comment Share on other sites More sharing options...
rpr Posted January 29, 2014 Report Share Posted January 29, 2014 Mainās pathi. bija '../Smarti', bet tagad ir 'functions/../Smarti' Quote Link to comment Share on other sites More sharing options...
briedis Posted January 29, 2014 Report Share Posted January 29, 2014 Jap, ieteikums vienmēr lietot absolūtos ceļus. Nodefinē index.php: define('DIR', dirname(__FILE__) . '/'); Un tad vienmēr izmanto: inlcude DIR . 'libs/blabla.php'; Quote Link to comment Share on other sites More sharing options...
Salv Posted February 6, 2014 Author Report Share Posted February 6, 2014 Paldies! Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.