Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> [Smarty] fetch(), problem chyba logiczny
BugsBunny
post
Post #1





Grupa: Zarejestrowani
Postów: 206
Pomógł: 4
Dołączył: 2.04.2005

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


Cała strona opiera się o Smarty.

mam np. index.php, któy wywołuje index.tpl w którym to są dwie zmienne
{$menu} // wyświetla MENU
{$strona} // wyświetla STRONY

a index.php jest taki
  1. <?php 
  2. require_once('system/smarty/Smarty.class.php');
  3.  
  4. $smarty = new Smarty;
  5.  $smarty->template_dir = $_home_path."style/";
  6.  $smarty->compile_dir = $_home_path.'system/templates/templates_c/';
  7. $smarty->config_dir  = $_home_path.'system/templates/configs/';
  8. $smarty->cache_dir = $_home_path.'system/templates/cache/'; 
  9.  define('APP_URL', 'http://10.1.1.133/~aktualnosci/');
  10.  $temp = $smarty->fetch('aktualnosci.php');
  11.  $smarty->assign('strona',$temp);
  12. $smarty->display('index.tpl');
  13. ?>


muszę wywietlić w zmiennej strony inną strone tj. aktualności.php.
Tylko że w niej są kolejne zmienne i chyba tutaj jest problem dlaczego nie chce mi to działać.

oto błąd

Warning: Smarty error: unable to read resource: "aktualnosci.php" in c:\usr\krasnal\www\aktualnosci\system\smarty\Smarty.class.php on line 1095

próbowałem też zamist aktualnosci.php dać odnosnik do aktualnosci.tpl ale chyba musze najpierw wywolac skrypt php ktory uzupelni dane.

Jak to zrobić (IMG:http://forum.php.pl/style_emoticons/default/questionmark.gif)
z góry thx (IMG:http://forum.php.pl/style_emoticons/default/cool.gif)
Go to the top of the page
+Quote Post
 
Start new topic
Odpowiedzi
BugsBunny
post
Post #2





Grupa: Zarejestrowani
Postów: 206
Pomógł: 4
Dołączył: 2.04.2005

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


Zrobiłem wszystko jak napisałes zmienijąc oczywiście niektóre stałe i niestety.

  1. <?php
  2. /**
  3.  * -------------------------------------------------------------
  4.  * 
  5.  * Dane lokalnych ustawien SMARTY.
  6.  * 
  7.  * @name class.Smarty.php, charset UTF-8
  8.  * @author nazihipi
  9.  * -------------------------------------------------------------
  10.  */
  11.  
  12. require_once APP_ROOT . 'klasy/config.inc.php';
  13. require_once APP_ROOT . 'system/smarty/Smarty.class.php';
  14.  
  15. class Application {
  16.  
  17. /**
  18.    * Ustaw sciezki do katalogow SMARTY
  19.    * 
  20.    * @access public
  21.    */
  22. function __construct() {
  23. $this->Smarty();  // TUTAJ BŁĄD
  24. $this->template_dir = TEMPLATE_DIR;
  25. $this->compile_dir = COMPILE_DIR;
  26. $this->config_dir = CONFIG_DIR;
  27. $this->plugins_dir[0] = PLUGINS;
  28. $this->plugins_dir[1] = SMARTY_PLUGINS;
  29. }
  30.  
  31. }
  32.  
  33. // Koniec class.Smarty.php 
  34. ?>



Fatal error: Call to undefined method Application::Smarty() in c:\usr\krasnal\www\aktualnosci\klasy\class.Smarty.php on line 23

Jeszcze z index.php usunąłem tę linie
  1. <?php
  2. require_once 'class.Get.php';
  3. ?>

bo nie mam takiego pliku

Pozatym chyba nie o to chodziło bo nie widze tu wywołania szablonu w szablonie

Ten post edytował BugsBunny 12.08.2006, 22:12:06
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: 6.10.2025 - 05:12