Smarty Forum Index Smarty
WARNING: All discussion is moving to https://reddit.com/r/smarty, please go there! This forum will be closing soon.

Anfänger braucht hilfe: Bilder anzeigen in Abhängingkeit von

 
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    Smarty Forum Index -> Language: German
View previous topic :: View next topic  
Author Message
Breakstuff
Smarty Rookie


Joined: 16 Sep 2010
Posts: 9

PostPosted: Thu Jul 25, 2013 10:18 am    Post subject: Anfänger braucht hilfe: Bilder anzeigen in Abhängingkeit von Reply with quote

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
View user's profile Send private message
Grizzly
Smarty Pro


Joined: 15 Apr 2011
Posts: 172
Location: Germany

PostPosted: Mon Jul 29, 2013 11:26 am    Post subject: Reply with quote

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
View user's profile Send private message Visit poster's website
Display posts from previous:   
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    Smarty Forum Index -> Language: German All times are GMT
Page 1 of 1

 
Jump to:  
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
Protected by Anti-Spam ACP