|
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 |
Bjoern3003 Smarty Rookie
Joined: 22 Nov 2004 Posts: 7
|
Posted: Wed Nov 24, 2004 11:14 pm Post subject: DB Abfrage mit HTML Darstellung |
|
|
Hi,
ich möchte per Datenbank abfragen, ob der wert xy in der Tabelle besteht. Sollte er drinnen sein, darf der HTML Code nicht angezeigt werden.
Beispiel:
Tabellenname "obst"
Inhalt: banane, Apfel, Birne
Wenn jetzt in der Variablen "$xy", die Birne drinnen steht, darf der HTML Code nicht angezeigt werden. Steht aber Pfirsich drinnen, soll der HTML Code angezeigt werden.
Ist sowas auf Basis von Smarty möglich?? |
|
Back to top |
|
the-styler Smarty Rookie
Joined: 12 Jul 2004 Posts: 25
|
Posted: Thu Nov 25, 2004 4:50 pm Post subject: |
|
|
Dies ist möglich. Du machst ganz normal deine abfrage in PHP. Dann übergibst du den wert smarty mit assign und prüfst das ganze in smarty mit einer if abfrage. den auszugegeben code schtreibst du dann in die if abfrage und sorgst dafür das sie true ist damit der html code ausgegeben wird. |
|
Back to top |
|
T. Smarty Regular
Joined: 22 Aug 2004 Posts: 69 Location: AT
|
Posted: Thu Nov 25, 2004 7:49 pm Post subject: |
|
|
einfach smarty code:
{if $xy ne "Birne"}
schreibe HTML Code
{/if}
siehe Smarty Dokumentation für Details _________________ Oppossom - Heavy rock from austria |
|
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
|