Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> smarty ---> błąd nie wiem czemu
exceender
post
Post #1





Grupa: Zarejestrowani
Postów: 8
Pomógł: 0
Dołączył: 3.01.2009

Ostrzeżenie: (0%)
-----


Witam jestem nowy na tym forum i proszę o wyrozumiałość w razie jakiś błędów.

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/';


i mam

Kod
function site (){
$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');


jak nie daje tego w plik funkcje.php nie używam smartów to jest wszystko ok.

Pozdrawiam ex
Go to the top of the page
+Quote Post
 
Start new topic
Odpowiedzi
exceender
post
Post #2





Grupa: Zarejestrowani
Postów: 8
Pomógł: 0
Dołączył: 3.01.2009

Ostrzeżenie: (0%)
-----


zrobiłem inaczej dodałem to co napisane w tym temacie : Temat: php_Templates

nie używałem przez chwilę smartów

dodałem plik class_temp.php dodałem potem dodałem to do funkcje.php

Kod
require_once("class_temp.php");


a potem dodałem

Kod
$tpl->display('test.tpl')


i o dziwo chodziło mi to teraz. Jak mógł by ktoś podać linki do jakiś systemów templates to bym był wdzięczny albo ktoś wie może czemu tak jest

Ten post edytował exceender 4.01.2009, 17:35:58
Go to the top of the page
+Quote Post

Posty w temacie


Reply to this topicStart new topic
2 Użytkowników czyta ten temat (2 Gości i 0 Anonimowych użytkowników)
0 Zarejestrowanych:

 



RSS Aktualny czas: 18.10.2025 - 06:40