|
Smarty
WARNING: All discussion is moving to https://reddit.com/r/smarty, please go there! This forum will be closing soon. |
|
View previous topic :: View next topic |
Author |
Message |
Breakstuff Smarty Rookie
Joined: 16 Sep 2010 Posts: 9
|
Posted: Thu Jul 25, 2013 10:18 am Post subject: Anfänger braucht hilfe: Bilder anzeigen in Abhängingkeit von |
|
|
Hallo,
ich habe leider noch nicht sonderlich viel Erfahrung mit Smarty aber ich komme ganz gut zu recht.
Nun habe ich aber ein Problem (was wahrscheinlich ganz einfach zu lösen ist) bei dem ich einfach nicht weiter komme.
Ich habe eine Website die auf einer index.smarty (Hauptseite) und einer default.smarty (alle anderen Seiten) aufbaut.
In der default.smarty wird ein Bild angezeigt welches zur Zeit noch auf jeder Seite (z.B. Produkte, News, Kontakte) gleich ist.
Ich möchte nun das je nach aufgerufener Seite ein anderes Bild dargestellt wird.
Was wäre denn der richtige Weg?
Bild Auswahl über php und diese php dann in der smarty datei aufrufen oder gleich direkt da rein? |
|
Back to top |
|
Grizzly Smarty Pro
Joined: 15 Apr 2011 Posts: 172 Location: Germany
|
Posted: Mon Jul 29, 2013 11:26 am Post subject: |
|
|
Wenn du bestimmte Übergabeparameter für die einzelnen Pages bzw. unterscheidung welche page du aufrufen musst, hast z. B. page=news oder page=produkte etc. kannst du direkt im template diesen übergabeparameter abfragen und dann das bild setzen:
Code: |
{if $smarty.get.page == "news"}
<img src="news.png" />
{else if $smarty.get.page == "produkte"}
<img src="produkte.png" />
{* usw. *}
{/if}
|
|
|
Back to top |
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|