![]() |
![]() |
![]()
Post
#1
|
|
Grupa: Zarejestrowani Postów: 3 Pomógł: 0 Dołączył: 9.02.2008 Ostrzeżenie: (0%) ![]() ![]() |
Mam problem .Skrypt php nie zamienia mi zmiennych w htmlu a w zasadzie smarty.wytlumaczcie ldaczego to nie dziala.
html: <html> <head> <title>SmartyNews!</title> </head> <body> <h3>{$wiadomosc.tytul}</h3> <p>Napisał {$wiadomosc.autor} dnia {$wiadomosc.data}</p> <p>{$wiadomosc.tresc|truncate:200:"..."}</p> </body> </html> php: <?php require("c:/wamp/www/smarty/Smarty.class.php"); // 1 $tpl = new Smarty; // 2 $tpl -> template_dir = 'c:/wamp/www/smarty/templates/'; $tpl -> compile_dir = 'c:/wamp/www/smarty/templates_c/'; $tpl -> assign('wiadomosc', array( 'tytul' => 'Premier podaje się do dymisji!', 'data' => date('d.m.Y'), 'autor' => 'Jan Nowak', 'tresc' => 'Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Cras nec diam. In hac habitasse platea dictumst. Donec id leo. Ut feugiat augue at metus. In hac habitasse platea dictumst. Donec pulvinar sollicitudin tellus. Quisque mattis faucibus nulla. Praesent in mauris. Maecenas erat nisi, laoreet in, porta nec, varius ut, turpis. Suspendisse pretium nibh at tellus placerat venenatis. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; Etiam felis arcu, ringilla a, commodo quis, blandit id, est. Fusce nec sapien nec libero dignissim volutpat.' )); $tpl -> display('c:/wamp/www/smarty/debug.tpl'); //4 ?> |
|
|
![]() |
![]()
Post
#2
|
|
Grupa: Zarejestrowani Postów: 64 Pomógł: 2 Dołączył: 13.07.2007 Skąd: Poznań Ostrzeżenie: (0%) ![]() ![]() |
W display podajesz debug.tpl, a nie caly adres. Pliki tpl tak wogole umieszczasz w folderze templates. Jezeli korzystasz z Smarty to zamiast $tpl powinno byc $smarty.
|
|
|
![]() ![]() |
![]() |
Aktualny czas: 4.10.2025 - 02:10 |