Mam problem z smartami mam w folderze include plik funkcje chcę w nim zdefiniować funkcje opartą na smarcie aby na każdej stronie jak ja wywołam to będzie menu itp. Używam WebServ.
w pliku funkcje.php mam:
Kod
define('SMARTY_DIR','./libs/smarty/');
require(SMARTY_DIR.'Smarty.class.php');
$smarty = new Smarty;
//tutaj podajemy sciezki do poszczegolnych katalogow (podalem przykladowe sdciezki)
// $_home_path - bezwzgledna sciezka do naszej strony
// mozna to zapisac inaczej (to tylko przyklad :) )
$smarty->template_dir = $_home_path.'./templates/';
$smarty->compile_dir = $_home_path.'./libs/templates_c/';
$smarty->config_dir = $_home_path.'./libs/configs/';
$smarty->cache_dir = $_home_path.'./cache/';
require(SMARTY_DIR.'Smarty.class.php');
$smarty = new Smarty;
//tutaj podajemy sciezki do poszczegolnych katalogow (podalem przykladowe sdciezki)
// $_home_path - bezwzgledna sciezka do naszej strony
// mozna to zapisac inaczej (to tylko przyklad :) )
$smarty->template_dir = $_home_path.'./templates/';
$smarty->compile_dir = $_home_path.'./libs/templates_c/';
$smarty->config_dir = $_home_path.'./libs/configs/';
$smarty->cache_dir = $_home_path.'./cache/';
i mam
Kod
function site (){
$smarty -> display('heder.tpl');
}
$smarty -> display('heder.tpl');
}
niby wszystko powinno być ok powinno brykać ale wyskakuje błąd
Cytat
Fatal error: Cannot redeclare class Smarty in C:\Program Files\WebServ\httpd\libs\smarty\Smarty.class.php on line 65
w Smarty.class.php w tej linii mam: {
kawałek kodu:
Kod
/**
* @package Smarty
*/
class Smarty
{
/**#@+
* Smarty Configuration Section
*/
/**
* The name of the directory where templates are located.
*
* @var string
*/
var $template_dir = './templates/LGTv2';
/**
* The directory where compiled templates are located.
*
* @var string
*/
var $compile_dir = './libs/templates_c';
/**
* The directory where config files are located.
*
* @var string
*/
var $config_dir = './libs/configs';
/**
* An array of directories searched for plugins.
*
* @var array
*/
var $plugins_dir = array('plugins');
* @package Smarty
*/
class Smarty
{
/**#@+
* Smarty Configuration Section
*/
/**
* The name of the directory where templates are located.
*
* @var string
*/
var $template_dir = './templates/LGTv2';
/**
* The directory where compiled templates are located.
*
* @var string
*/
var $compile_dir = './libs/templates_c';
/**
* The directory where config files are located.
*
* @var string
*/
var $config_dir = './libs/configs';
/**
* An array of directories searched for plugins.
*
* @var array
*/
var $plugins_dir = array('plugins');
jak nie daje tego w plik funkcje.php nie używam smartów to jest wszystko ok.
Pozdrawiam ex