Jump to content
php.lv forumi

Kas šajā gadījumā funkcijai jāatgriež?


Salv

Recommended Posts

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');
?>
Link to comment
Share on other sites

  • 2 weeks later...

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...