Czy możecie mi dać prosty przyklad.
Zrobiłem sobie strone index.php Która zawiera następujący kod ..
................................................................................
........................................
<? //Dołączenie klasy głownej do smarty index.tpl require_once('.../Smarty/Smarty.class.php'); //Tworzenie obiektu require_once('.../config/application.inc.php'); try { Lang::init(); } catch (Exception $err) { } $smarty = new SmartyTemplate(); $smarty->assign_by_ref('Interface', new ApplicationInterface()); //Tworzenie własnej zmiennej imie $smarty->assign('imie','KATALOG GŁÓWNY'); $smarty->assign('menu1','company.phtml'); $smarty->assign('menu2','MENU2'); $smarty->assign('menu3','MENU3'); $smarty->assign('menu4','MENU4'); $smarty->assign('CATEGORY_SPECIALS','GŁOWNA KATEGORIA'); $smarty->assign('PRODUCT_NAMAE','TYTUŁ'); $smarty->assign('PRODUCT_DESCRIPTION','Strona podtytułowa body'); $smarty->assign('PRODUCT_PRICE','156'); $smarty->assign('COPYRIGHT_YEARS','Prawa autorskie ©2007 dla MARCIN'); $smarty->assign('images', array('images1'=>'<img src="../smartydirs/templates/images/baner.jpg" width=" 1078" height="94" alt="[Rozmiar: 28095 bajtów]">',//widok zdjec aluplastu 'logo'=>'<img src="../smartydirs/templates/images/logo.jpg" width="139" height="94" align="top" alt="[Rozmiar: 12258 bajtów]">', 'pl'=>'<a href="?lang=pl"><img src="../smartydirs/templates/images/pl.jpg" width="30" height="13" alt="[Rozmiar: 751 bajtów]"></a>', 'de'=>'<a href="?lang=de"><img src="../smartydirs/templates/images/de.jpg" width="30" height="13" alt="[Rozmiar: 799 bajtów]"></a>' )); //Wyświetlenie szablonu tpl $smarty->display('start.tpl') ; ?>
................................................................................
........................................................
Potem plik szablonu start.tpl
................................................................................
...........................................................
<html xmlns="http://www.w3.org/1999/xhtml" lang="{$Interface->getMessage('html_symbol')}" xml:lang="{$Interface->getMessage('html_symbol')}"> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> <STYLE type="text/css"> {literal} <!-- BODY { margin: 0px; } -->{/literal} </STYLE> <body> </table> </body> </html> </html>
................................................................................
.................................................
NO i chodzi mi o to zebym w pliku menu.tpl/
zrobil cos takiego np:
<a href="">O mnie</a>
<a href="">Produkty</a>
<a href="">Kontakt</a>
<a href="">wolna</a>
I jak klikne na odnosnik w plikumenu.tpl to zeby on zmienial mi strone intro.tpl.
Nie bardzo sobie umię z tym poradzić wiem że należy skorzystać z tablicy asocjacyjnej oraz z funkcji GET
Ale nie bardzo potrafie to skleic w kupe i sie do tego odwołać. Dlatego najlepiej prosił bym o przedstawienie prostego przykładu.
Prosze też nie myśleć że licze na gotowizne ponieważ już 4 dni nad tym siedzę i nic. Poprostu zalamac sie mozna
Jak naraize doszedlem do czegos takiego w pliku index.php ale nie potrafię sie do tego nijak odwołać.
Wszystko co robie to z ksiażek lub internetu.
.....
<?php $strona = 'intro'; $strona = $_GET['go']; } $smarty->assign('page', $strona.'.tpl'); ?>
...
Jak wybieram {$page} to mi się wyświetla strona intro.tpl/ Coś pewnie z tym kodem źle robię.
BARDZO WAS PROSZĘ O POMOC > JAK ZOBACZE PRZYKLAD TO MOŻE WKOŃCU ZROZUMIĘ>
Używaj BBCode inaczej zarobisz ostrzeżenie
~kwiateusz