doti
22.06.2011, 20:47:38
Witam,
Jestem na forum pierwszy raz i nie wiem gdzie pisać na temat smartów, wiec wybrałam ten dział.
Jeśli temat nie nadaje sie do tego działu prosze o przeniesienie.
Zainstalowałam wampserwer-a i strone zrobioną na smartach (która działała na innym serwerze bez zarzutu)
Po wyświetleniu strony o takim adresie:
http://localhost/test/index.htmlpojawia sie komunikat błędu:
rodzaj : 512
tresc : Smarty error: unable to read resource: ""
plik : E:\wamp\www\test\libs\Smarty.class.php
wiersz : 1088
data : 2011-06-22, 21:36
Nie wiem gdzie jest błąd, czy w konfiguracji wampa, czy w plikach smarty jest coś nie tak.
bardzo proszę o pomoc
pozdrawiam wszystkich
CuteOne
23.06.2011, 03:45:50
Oj tak na pewno w plikach SMARTY coś jest nie tak... lepiej wklej tu zawartość pliku index.html i includowanych
doti
23.06.2011, 12:25:19
zawartość pliku index.php:
CODE
<?php
ini_set ('register_globals', 0);
// ustawienie aby id sesji przechowywane bylo zawsze w ciasteczku
ini_set('session.use_only_cookies', 1);
// czas zycia ciasteczka sesyjnego w sekundach
ini_set('session.cookie_lifetime', 1800);
//- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
// nazwa sesji
session_name('eTankuj');
// inicjalizacja sesji
session_start();
// generowanie nowego identyfikatora z kazdym wywolaniem skryptu
session_regenerate_id();
//- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
include_once 'configs/config.inc.php';
include_once 'include/smarty_setup.inc.php';
include_once 'include/error_handler.inc.php';
include_once 'include/navigation.inc.php';
$smarty = new Page();
include_once 'configs/languages.php';
//- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
include_once 'class/class.db_controller.php';
$sql = new DbController();
$sql->connect(DB_HOST, DB_USER_LOGIN, DB_USER_PASS, DB_NAME);
//- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
if(isset($_REQUEST['run']))
{
Navigation::Run($smarty, $_REQUEST);
}
else
{
Navigation::Redirect(array('run'=>'Index.Main'));
}
//- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
$smarty->display('page_body.tpl');
//echo '<pre>';
//print_r($_SESSION);
//echo '</pre>';
?>
mit2
23.06.2011, 13:52:41
pokaz zawartosc tego pliku
E:\wamp\www\test\libs\Smarty.class.php
nospor
23.06.2011, 15:45:29
@mit2 chyba nie tędy droga
@doti smarty w Twoim przypadku próbuje odczytać zasób, o nazwie "" czyli o braku jakiejkolwiek nazwy.
Wina nie leży więc po stronie Smartiego a aplikacji, że przekazuje zasób o pustej nazwie.
Może to być np. winą register_globals lub kupą masą innych rzeczy.
Włącz najlepiej wyświetlanie wszystkich błędów, a sprawa może się wyjaśni.
Tu masz napisane jak to zrobić.
Temat: Jak poprawnie zada pytanieJeśli ta aplikacja jest stara , to może się okazać, że chodzi właśnie o register_globals. Włącz więć wpierw tę opcję (w pliku php.ini), zrestartuj serwer i spróbuj jeszcze raz odpalić aplikację.
doti
23.06.2011, 22:19:14
po włączeniu wszystkich błędów oprócz powyższego błędu pojawił sie kolejny komunikat:
Notice: Undefined index: id in E:\wamp\www\test\include\navigation.inc.php on line 140
Jeśli chodzi o "register_globals" to mam włączone w wampie w ustawieniach php.
nospor
24.06.2011, 07:17:09
Tylko jeden dodatkowy błąd?
Nie wiele to mówi w takim razie.
Owszem, może być tak, że zasób jest określany na podstawie ID, którego właśnie nie ma.
doti
24.06.2011, 09:56:04
tylko problem jest taki ze ta strona dziala na innym serwerze a na moim nie chce ruszyc...
więc wydaje mi się ze to jednak ustawienia wampa odpowiadają za te błędy.
Tylko nie mam pojęcia które to ustawienia.
nospor
24.06.2011, 10:46:25
Cytat
więc wydaje mi się ze to jednak ustawienia wampa odpowiadają za te błędy.
Tak, i dlatego myślałem, w pierwszej chwili, że chodzi właśnie o register_globals.
Do rozwiązania zagadki może się okazać, że jest potrzebny ten kawałek kodu, w którym smarty próbuje załadować pusty zasób.
W tym celu wejdź do pliku Smart.class.php w okolicę linii 1088. Powinieneś tam mieć funkcje coś ala:
function trigger_error()
W ciele tej funkcje daj kod:
debug_print_backtrace();
i będziemy wówczas znali całą ścieżkę błędu.
doti
24.06.2011, 11:22:00
po dokonianiu zmian w funkcji trigger_error wyświetliło dosyć spory kawałek błędów, oto one:
#0 Smarty->trigger_error(unable to read resource: "") called at [E:\wamp\www\test\libs\Smarty.class.php:1585] #1 Smarty->_fetch_resource_info(Array ([resource_name] => ,[get_source] => 1,[quiet] => )) called at [E:\wamp\www\test\libs\Smarty.class.php:1411] #2 Smarty->_compile_resource(, E:\wamp\www\test/tpl/_compile/\.php) called at [E:\wamp\www\test\libs\Smarty.class.php:1860] #3 Smarty->_smarty_include(Array ([smarty_include_tpl_file] => ,[smarty_include_vars] => Array ())) called at [E:\wamp\www\test\tpl\_compile\%%15_150_1504C075%%page_body.tpl.php:50] #4 include(E:\wamp\www\test\tpl\_compile\%%15_150_1504C075%%page_body.tpl.php) called at [E:\wamp\www\test\libs\Smarty.class.php:1259] #5 Smarty->fetch(page_body.tpl, , , 1) called at [E:\wamp\www\test\libs\Smarty.class.php:1102] #6 Smarty->display(page_body.tpl) called at [E:\wamp\www\test\index.php:53]
nospor
24.06.2011, 11:29:28
Pokaż plik page_body.tpl
oraz plik skompilowany czyli:
E:\wamp\www\test\tpl\_compile\%%15_150_1504C075%%page_body.tpl.php
Cytat
wyświetliło dosyć spory kawałek błędów
To nie błędy a informacje debugujące o które prosiłem
doti
24.06.2011, 11:29:37
plik page_body.tpl:
CODE
{config_load file="site.conf"}
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset={#pageCharset#}" />
<title>Mewa Druk Drukarnia</title>
<link href="css/global.css" rel="stylesheet" type="text/css"/>
<link href="css/lightbox.css" rel="stylesheet" type="text/css"/>
<link href="css/{$cur_obj}.css" rel="stylesheet" type="text/css"/>
{if $cur_lang == 0}
<link href="css/pl.css" rel="stylesheet" type="text/css"/>
{elseif $cur_lang == 1}
<link href="css/en.css" rel="stylesheet" type="text/css"/>
{elseif $cur_lang == 2}
<link href="css/de.css" rel="stylesheet" type="text/css"/>
{/if}
<script src="js/prototype.js" type="text/javascript"></script>
<script src="js/window.js" type="text/javascript"></script>
<script src="js/scriptaculous.js?load=effects" type="text/javascript"></script>
<script src="js/lightbox.js" type="text/javascript"></script>
<script src="js/global.js" type="text/javascript"></script>
<script src="js/index.js" type="text/javascript"></script>
<script src="js/minmax.js" type="text/javascript"></script>
<script language="javascript">AC_FL_RunContent = 0;</script>
<script src="js/AC_RunActiveContent.js" language="javascript"></script>
</head>
<body>
<div id="PageTop">{include file="page_top.tpl"}</div>
<div id="PageMenu">{include file="page_menu.tpl"}</div>
<div id="PageBody">{include file=$basepage}</div>
<div id="PageBottom">{include file="page_bottom.tpl"}</div>
<div id="PageFooter">{include file="page_footer.tpl"}</div>
</body>
</html>
plik skompilowany:
<?php /* Smarty version 2.6.9, created on 2011-06-22 21:54:41
compiled from page_body.tpl */ ?>
<?php require_once(SMARTY_CORE_DIR . 'core.load_plugins.php');
smarty_core_load_plugins
(array('plugins' => array(array('function', 'config_load', 'page_body.tpl', 1
, false),)), $this); ?><?php echo smarty_function_config_load
(array('file' => "site.conf"), $this);?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=
<?php echo $this->_config
[0]['vars']['pageCharset']; ?>" />
<title>Mewa Druk Drukarnia</title>
<link href="css/global.css" rel="stylesheet" type="text/css"/>
<link href="css/lightbox.css" rel="stylesheet" type="text/css"/>
<link href="css/
<?php echo $this->_tpl_vars
['cur_obj']; ?>.css" rel="stylesheet" type="text/css"/>
<?php if ($this->_tpl_vars['cur_lang'] == 0): ?>
<link href="css/pl.css" rel="stylesheet" type="text/css"/>
<?php elseif ($this->_tpl_vars['cur_lang'] == 1): ?>
<link href="css/en.css" rel="stylesheet" type="text/css"/>
<?php elseif ($this->_tpl_vars['cur_lang'] == 2): ?>
<link href="css/de.css" rel="stylesheet" type="text/css"/>
<?php endif; ?>
<script src="js/prototype.js" type="text/javascript"></script>
<script src="js/window.js" type="text/javascript"></script>
<script src="js/scriptaculous.js?load=effects" type="text/javascript"></script>
<script src="js/lightbox.js" type="text/javascript"></script>
<script src="js/global.js" type="text/javascript"></script>
<script src="js/index.js" type="text/javascript"></script>
<script src="js/minmax.js" type="text/javascript"></script>
<script language="javascript">AC_FL_RunContent = 0;</script>
<script src="js/AC_RunActiveContent.js" language="javascript"></script>
</head>
<body>
<div id="PageTop"><?php $_smarty_tpl_vars = $this->_tpl_vars;
$this->_smarty_include
(array('smarty_include_tpl_file' => "page_top.tpl", 'smarty_include_vars' => array())); $this->_tpl_vars = $_smarty_tpl_vars;
unset($_smarty_tpl_vars); ?></div>
<div id="PageMenu"><?php $_smarty_tpl_vars = $this->_tpl_vars;
$this->_smarty_include
(array('smarty_include_tpl_file' => "page_menu.tpl", 'smarty_include_vars' => array())); $this->_tpl_vars = $_smarty_tpl_vars;
unset($_smarty_tpl_vars); ?></div>
<div id="PageBody"><?php $_smarty_tpl_vars = $this->_tpl_vars;
$this->_smarty_include
(array('smarty_include_tpl_file' => $this->_tpl_vars
['basepage'], 'smarty_include_vars' => array())); $this->_tpl_vars = $_smarty_tpl_vars;
unset($_smarty_tpl_vars); ?></div>
<div id="PageBottom"><?php $_smarty_tpl_vars = $this->_tpl_vars;
$this->_smarty_include
(array('smarty_include_tpl_file' => "page_bottom.tpl", 'smarty_include_vars' => array())); $this->_tpl_vars = $_smarty_tpl_vars;
unset($_smarty_tpl_vars); ?></div>
<div id="PageFooter"><?php $_smarty_tpl_vars = $this->_tpl_vars;
$this->_smarty_include
(array('smarty_include_tpl_file' => "page_footer.tpl", 'smarty_include_vars' => array())); $this->_tpl_vars = $_smarty_tpl_vars;
unset($_smarty_tpl_vars); ?></div>
</body>
</html>
nospor
24.06.2011, 11:40:02
{include file=$basepage}
Zmienna $basepage nie jest określona.
Wyszukaj teraz w kodzie kodu, który przypisuje coś do basepage.
Najlepiej szukaj po frazie basepage
Kawałek jaki mnie interesuje będzie wyglądał prawdopodobnie tak:
->assign('basepage',
A słuchaj... powiedz mi jeszcze, czy oprócz tego, że wyswietla ci się ten blad:
rodzaj : 512
tresc : Smarty error: unable to read resource: ""
plik : E:\wamp\www\test\libs\Smarty.class.php
wiersz : 1088
data : 2011-06-22, 21:36
To strona działa normalnie? Czy może jednak wyświetla się ten błąd i strona już nie działa?
ps: prawdopodobnie ten basepage jest ustawiany w pliku navigation.inc.php więc pokaż mi ten plik
doti
24.06.2011, 12:54:07
strona wyświetla się jak poprzednio czyli:
u góry błąd:
Notice: Undefined index: id in E:\wamp\www\test\include\navigation.inc.php on line 140
nastepnie wyswietla mi sie baner i menu a w czesci gdzie jest tresc strony ten "długi" błąd:
#0 Smarty->trigger_error(unable to read resource: "") called at [E:\wamp\www\test\libs\Smarty.class.php:1585] #1 Smarty->_fetch_resource_info(Array ([resource_name] => ,[get_source] => 1,[quiet] => )) called at [E:\wamp\www\test\libs\Smarty.class.php:1411] #2 Smarty->_compile_resource(, E:\wamp\www\test/tpl/_compile/\.php) called at [E:\wamp\www\test\libs\Smarty.class.php:1860] #3 Smarty->_smarty_include(Array ([smarty_include_tpl_file] => ,[smarty_include_vars] => Array ())) called at [E:\wamp\www\test\tpl\_compile\%%15_150_1504C075%%page_body.tpl.php:50] #4 include(E:\wamp\www\test\tpl\_compile\%%15_150_1504C075%%page_body.tpl.php) called at [E:\wamp\www\test\libs\Smarty.class.php:1259] #5 Smarty->fetch(page_body.tpl, , , 1) called at [E:\wamp\www\test\libs\Smarty.class.php:1102] #6 Smarty->display(page_body.tpl) called at [E:\wamp\www\test\index.php:53]
i na dole stopka normalnie sie wyświetla.
czyli bląd jest gdzieś w ładowaniu treści strony która zresztą pochodzi z bazy danych
nospor
24.06.2011, 13:01:05
W poprzednim poście prosiłem CIę o parę rzeczy. Odpowiedziałeś tylko na jedną z nich.
doti
24.06.2011, 13:29:24
zawartośc pliku navigation.inc.php
<?php
class Navigation
{
var $params;
var $smarty;
//
//- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
//
function __construct ( &$smarty, $params )
{
$this->params = $params;
$this->smarty = $smarty;
}
//
//- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
//
function GetParams($fields)
{
foreach ($fields as $f)
$out[$f] = $this->params[$f];
return $out;
}
//
//- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
//
function GetFormVariable($fields)
{
foreach ($fields as $f)
{
$out[$f] = trim($this->params[$f]); }
return $out;
}
//
//
//
function HTML_entities_encode (&$fields)
{
if ( count($fields) > 0
) {
foreach ($fields as $key => &$val)
{
}
}
}
//
//- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
//
function Redirect($params){
// sprawdza czy podano parametr 'run'
// sprawdzanei poprawnosci parametru 'run' ( nazwa_klasy:nazwa_metody )
if ( !ereg('^[a-zA-Z]+\.[a-zA-Z0-9_]+$',$params['run'])) trigger_error('parametr: run ma niepoprawna skladnie', E_USER_WARNING
);
$tab = explode('.', $params['run']);
$id_params = '';
$id_params = ','.$params['id'];
if ( $method == 'main' )
Header("Location: $class_name$id_params.html"); else
Header("Location: $class_name,$method$id_params.html"); }
//
//- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
//
function Run(&$smarty, $params)
{
// sprawdza czy podano parametr 'run'
// sprawdzanei poprawnosci parametru 'run' ( nazwa_klasy:nazwa_metody )
if ( !ereg('^[a-z]+\.[a-z0-9_]+$',$params['run'])) trigger_error('parametr: run ma niepoprawna skladnie', E_USER_WARNING
);
$tab = explode('.', $params['run']);
// sprawdzenie istnienia pliku klasy
{
include_once SITE_ROOT
.'/pages/' . strtolower($class_name) . '.php'; }
else
{
trigger_error("plik: $class_name.php nie istnieje", E_USER_WARNING
); }
// sprawdzanie istnienia deklaracji klasy
if ( class_exists($class_name))
{
$object = new $class_name($smarty, $params);
}
else
{
trigger_error("brak zdefiniowanej klasy: $class_name", E_USER_WARNING
); }
// sprawdzanie czy istnieje metoda oraz czy jest ona publiczna
if(!is_callable
(array($object, $method))) trigger_error("brak metody: $method w klasie: $class_name lub jest ona prywatna", E_USER_WARNING
);
// sprawdza czy zdefiniowano modyfikator dostepu dla metody
trigger_error("brak zdefiniowanego modyfikatora dostepu do metody: $method w klasie: $class_name", E_USER_WARNING
);
// sprawdzanie dostepu do metody (free, admin itp)
if (in_array('guest', $object->perms[$method])) {
$smarty->assign('cur_obj', strtolower($class_name)); $smarty->assign('cur_id', $_GET['id']);
$object->$method($smarty, $params);
}
else if (in_array($_SESSION['user_type'], $object->perms[$method])) {
$smarty->assign('cur_obj', strtolower($class_name)); $smarty->assign('cur_id', $_GET['id']);
$object->$method($smarty, $params);
}
else
{
Header("Location: index.html"); }
}
}
?>
nospor
24.06.2011, 13:32:18
Cytat
a w czesci gdzie jest tresc strony
Ale treść strony też się wyświetla?
doti
24.06.2011, 13:42:51
właśnie nie wyświetla mi sie treśc strony (to co pochodzi z bazy).
Połaczenie z baza wiem ze mam prawidłowe, ale nie mam pojecia dlaczego wysypuje sie ten błąd.
mortus
24.06.2011, 13:57:08
Pokaż treść pliku site.conf.
nospor
24.06.2011, 14:21:04
Czyli chodzi jednak nadal o ten basepage. Szukaj więc gdzie on jest określany jak ci pisałem parę postów temu.
doti
24.06.2011, 14:42:09
nie wiem czy o to chodzi.
W katalogu pages w pliku index.php znalazłam cos z basepage.
Podaje cały kod pliku index.php z katalogu pages:
CODE
<?php
include_once 'include/navigation.inc.php';
include_once 'db/db_index.php';
// # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # //
class Index extends Navigation
{
private $db;
var $perms;
function __construct(&$smarty, $params)
{
parent::__construct($smarty, $params);
$this->perms['Main'] = array('guest');
$this->perms['News'] = array('guest');
$this->perms['Archiwum'] = array('guest');
$this->db = new DbIndex();
}
// # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # //
function Main()
{
$this->smarty->assign('powitanie', $this->db->getPowitanieTxt());
$this->smarty->assign('specjalisci', $this->db->getSpecjalisciTxt());
$this->smarty->assign('systemy', $this->db->getSystemyTxt());
$this->smarty->assign('basepage', 'index/main.tpl');
}
// # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # //
function News()
{
if ( !isset($this->params['id']) )
{
$this->Redirect(array('run' => 'Index.Main'));
}
$this->smarty->assign('news_main', $this->db->getNews($this->params['id']));
$this->smarty->assign('basepage', 'index/news.tpl');
}
// # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # //
function Archiwum()
{
if ( !isset($this->params['id']) )
{
$current_page = 1;
}
else
{
$current_page = $this->params['id'];
}
if ( $this->db->getMaxPageNumber() < $current_page )
Navigation::Redirect(array('run'=>'Index.Archiwum'));
$this->smarty->assign('current_page', $current_page);
$this->smarty->assign('max_page_number', $this->db->getMaxPageNumber());
$this->smarty->assign('news_main', $this->db->getNewsLimit($current_page));
$this->smarty->assign('basepage', 'index/archiwum.tpl');
}
}
?>
i tak jest przy kazdej z podstron (np. oferta tutaj podaje wycinek z pliku oferta.php > $this->smarty->assign('basepage', 'oferta/main.tpl')

napisz czy o to chodziło
nie znalazłam więcej wpisów z "basepage"
mortus
24.06.2011, 16:22:17
O to chodziło. W pliku index.php powinieneś użyć zamiast:
if(isset($_REQUEST['run'])) {
Navigation::Run($smarty, $_REQUEST);
}
else
{
Navigation
::Redirect(array('run'=>'Index.Main'));}
tego
if(isset($_REQUEST['run'])) {
Index::Run($smarty, $_REQUEST);
}
else
{
Index
::Redirect(array('run'=>'Index.Main'));}
I jeszcze na początku gdzieś:
include_once 'ścieżka_do_katalogu_pages/index.php';
Ech... A jednak nie do końca! Po przeanalizowaniu funkcji Run klasy Navigation dochodzę do wniosku, że powinno to działać. Pytanie, czy klasa ta tworzy poprawni obiekt (linia 120 w pliku navigation.inc.php w oparciu o parametr w $_REQUEST, bo wygląda na to, że nie do końca. W sumie to nie wiem dlaczego.
Trochę to zakręcone: bezpośrednio przy pomocy metody Run klasy Navigation tworzymy obiekt klasy Index, rozszerzającej klasę Navigation. Za każdym razem przekazujemy referencję do szablonu Smarty. Na końcu metody Run sprawdziłbym, co się znajduje w naszej klasie Navigation dodając:
w liniach 142 i 149.
doti
24.06.2011, 21:20:05
dodając: echo '<pre>'; var_dump($this);
w liniach 142 i 149 strona sie rozsypala. Pojawiaja sie te same elementy co wczesniej ale "porozjeżdzane" a u góry wyświetla błędy:
Notice: Undefined index: id in E:\wamp\www\test\include\navigation.inc.php on line 140
Notice: Undefined variable: this in E:\wamp\www\test\include\navigation.inc.php on line 142
NULL
zaś w części gdzie powinna znajdować sie treść strony:
#0 Smarty->trigger_error(unable to read resource: "") called at [E:\wamp\www\test\libs\Smarty.class.php:1585]
#1 Smarty->_fetch_resource_info(Array ([resource_name] => ,[get_source] => 1,[quiet] => )) called at [E:\wamp\www\test\libs\Smarty.class.php:1411]
#2 Smarty->_compile_resource(, E:\wamp\www\test/tpl/_compile/\.php) called at [E:\wamp\www\test\libs\Smarty.class.php:1860]
#3 Smarty->_smarty_include(Array ([smarty_include_tpl_file] => ,[smarty_include_vars] => Array ())) called at [E:\wamp\www\test\tpl\_compile\%%15_150_1504C075%%page_body.tpl.php:50]
#4 include(E:\wamp\www\test\tpl\_compile\%%15_150_1504C075%%page_body.tpl.php) called at [E:\wamp\www\test\libs\Smarty.class.php:1259]
#5 Smarty->fetch(page_body.tpl, , , 1) called at [E:\wamp\www\test\libs\Smarty.class.php:1102]
#6 Smarty->display(page_body.tpl) called at [E:\wamp\www\test\index.php:54]
oj chyba nie dojdziemy do sedna...
mortus
24.06.2011, 21:29:52
To jak nam klasa nie chce pokazać samej siebie, to niech nam chociaż pokaże $smarty. W tych samych liniach, co poprzednio zamiast var_dump($this) wstaw var_dump($smarty).
Powinno nam to pokazać obiekt Smarty z przypisaną już zmienną $basepage.
doti
24.06.2011, 21:35:57
no to teraz się wysypało:
CODE
Notice: Undefined index: id in E:\wamp\www\test\include\navigation.inc.php on line 140
object(Page)#1 (58) {
["template_dir"]=>
string(21) "E:\wamp\www\test/tpl/"
["compile_dir"]=>
string(30) "E:\wamp\www\test/tpl/_compile/"
["config_dir"]=>
string(25) "E:\wamp\www\test/configs/"
["plugins_dir"]=>
array(2) {
[0]=>
string(30) "E:\wamp\www\test/libs//plugins"
[1]=>
string(24) "E:\wamp\www\test/plugins"
}
["debugging"]=>
bool(false)
["error_reporting"]=>
NULL
["debug_tpl"]=>
string(0) ""
["debugging_ctrl"]=>
string(4) "NONE"
["compile_check"]=>
bool(true)
["force_compile"]=>
bool(false)
["caching"]=>
int(0)
["cache_dir"]=>
string(5) "cache"
["cache_lifetime"]=>
int(3600)
["cache_modified_check"]=>
bool(false)
["php_handling"]=>
int(0)
["security"]=>
bool(false)
["secure_dir"]=>
array(0) {
}
["security_settings"]=>
array(6) {
["PHP_HANDLING"]=>
bool(false)
["IF_FUNCS"]=>
array(11) {
[0]=>
string(5) "array"
[1]=>
string(4) "list"
[2]=>
string(5) "isset"
[3]=>
string(5) "empty"
[4]=>
string(5) "count"
[5]=>
string(6) "sizeof"
[6]=>
string(8) "in_array"
[7]=>
string(8) "is_array"
[8]=>
string(4) "true"
[9]=>
string(5) "false"
[10]=>
string(4) "null"
}
["INCLUDE_ANY"]=>
bool(false)
["PHP_TAGS"]=>
bool(false)
["MODIFIER_FUNCS"]=>
array(1) {
[0]=>
string(5) "count"
}
["ALLOW_CONSTANTS"]=>
bool(false)
}
["trusted_dir"]=>
array(0) {
}
["left_delimiter"]=>
string(1) "{"
["right_delimiter"]=>
string(1) "}"
["request_vars_order"]=>
string(5) "EGPCS"
["request_use_auto_globals"]=>
bool(true)
["compile_id"]=>
NULL
["use_sub_dirs"]=>
bool(false)
["default_modifiers"]=>
array(0) {
}
["default_resource_type"]=>
string(4) "file"
["cache_handler_func"]=>
NULL
["autoload_filters"]=>
array(2) {
["pre"]=>
array(1) {
[0]=>
string(20) "remove_html_comments"
}
["output"]=>
array(1) {
[0]=>
string(14) "trimwhitespace"
}
}
["config_overwrite"]=>
bool(true)
["config_booleanize"]=>
bool(true)
["config_read_hidden"]=>
bool(false)
["config_fix_newlines"]=>
bool(true)
["default_template_handler_func"]=>
string(0) ""
["compiler_file"]=>
string(25) "Smarty_Compiler.class.php"
["compiler_class"]=>
string(15) "Smarty_Compiler"
["config_class"]=>
string(11) "Config_File"
["_tpl_vars"]=>
array(5) {
["SCRIPT_NAME"]=>
string(15) "/test/index.php"
["cur_lang"]=>
string(1) "0"
["cur_obj"]=>
string(5) "index"
["cur_meth"]=>
string(4) "main"
["cur_id"]=>
NULL
}
["_smarty_vars"]=>
NULL
["_sections"]=>
array(0) {
}
["_foreach"]=>
array(0) {
}
["_tag_stack"]=>
array(0) {
}
["_conf_obj"]=>
NULL
["_config"]=>
array(1) {
[0]=>
array(2) {
["vars"]=>
array(0) {
}
["files"]=>
array(0) {
}
}
}
["_smarty_md5"]=>
string(32) "f8d698aea36fcbead2b9d5359ffca76f"
["_version"]=>
string(5) "2.6.9"
["_inclusion_depth"]=>
int(0)
["_compile_id"]=>
NULL
["_smarty_debug_id"]=>
string(12) "SMARTY_DEBUG"
["_smarty_debug_info"]=>
array(0) {
}
["_cache_info"]=>
array(0) {
}
["_file_perms"]=>
int(420)
["_dir_perms"]=>
int(505)
["_reg_objects"]=>
array(0) {
}
["_plugins"]=>
array(9) {
["modifier"]=>
array(0) {
}
["function"]=>
array(0) {
}
["block"]=>
array(0) {
}
["compiler"]=>
array(0) {
}
["prefilter"]=>
array(0) {
}
["postfilter"]=>
array(0) {
}
["outputfilter"]=>
array(0) {
}
["resource"]=>
array(0) {
}
["insert"]=>
array(0) {
}
}
["_cache_serials"]=>
array(0) {
}
["_cache_include"]=>
NULL
["_cache_including"]=>
bool(false)
}
mortus
24.06.2011, 22:36:06
No i to oznacza, że gubimy referencję. Odpowiedź na pytanie "Dlaczego?" jest tak zakręcona, jak działanie skryptu i nawet nie wiem, czy umiem poprawnie na to pytanie odpowiedzieć.
Wygląda na to, że nie można w taki sposób przekazywać referencji - przynajmniej w nowszych wersjach PHP.
doti
25.06.2011, 20:06:30
mam jeszcze pytanie: dlaczego ta strona działa na innym serwerze?? Skoro to błąd w smartach to też nie powinna działac...
nie mam już sił...
mortus
25.06.2011, 20:26:58
Może to kwestia wersji PHP. Jeśli masz możliwość, to sprawdź, jaka wersja jest na serwerze i porównaj z lokalną.
doti
25.06.2011, 20:38:13
wersja php (wersja 5.2.6) jest taka sama na obu serwerach.
To jest wersja lo-fi głównej zawartości. Aby zobaczyć pełną wersję z większą zawartością, obrazkami i formatowaniem proszę
kliknij tutaj.