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

Smarty Funktion in MYSQL DB

 
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
Stargast
Smarty n00b


Joined: 27 Nov 2004
Posts: 3

PostPosted: Sat Nov 27, 2004 8:11 pm    Post subject: Smarty Funktion in MYSQL DB Reply with quote

Hey,

bin gerade dabei ein Guestbook zu programmieren, welches Smilies unterstützt aber leider komm ich jetzt nicht mehr weiter. Die Smilies werden durch die entsprechende Smarty Funktion ersetzt
z.B.:
Code:
$text = eregi_replace(":-\)|:\)", "{html_image file=\"images/smilies/smile.gif\" alt=\"\"}", $text);


und in die DB eingetragen. Beim Ausgeben wird die Smarty Funktion aber nicht compiled sondern so ausgegen, wie sie eingetragen wurde.
z.B.
Code:
"{html_image file=\"images/smilies/smile.gif\" alt=\"\"}


Ich hoffe das war verständlich!?
Wie schaffe ich es jetzt, dass <img src="......> anstatt der Smarty Funktion ausgegeben wird?


Vielen Dank im Voraus! MfG
Back to top
View user's profile Send private message
messju
Administrator


Joined: 16 Apr 2003
Posts: 3336
Location: Oldenburg, Germany

PostPosted: Sat Nov 27, 2004 9:31 pm    Post subject: Reply with quote

warum ersetzt du die smilies nicht einfach durch <img>-tags statt durch smarty-tags?
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Stargast
Smarty n00b


Joined: 27 Nov 2004
Posts: 3

PostPosted: Sun Nov 28, 2004 12:16 am    Post subject: Reply with quote

Ja, an das hab ich auch schon gedacht aba ich würd halt gern wissen ob das anders (mit einem smarty-tag) auch möglich ist.
Back to top
View user's profile Send private message
messju
Administrator


Joined: 16 Apr 2003
Posts: 3336
Location: Oldenburg, Germany

PostPosted: Sun Nov 28, 2004 12:44 am    Post subject: Reply with quote

hmm hmm.
ja, prinzipiell ist das möglich mit resources oder mit {eval}.
aber das ist für den einsatzzweck den du beschreibst (gästebucheinträge) alles andere als empfehlenswert.
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Stargast
Smarty n00b


Joined: 27 Nov 2004
Posts: 3

PostPosted: Sun Nov 28, 2004 11:44 am    Post subject: Reply with quote

Ja, wär blöd wenn jeder irgendwelche Smarty-Tags in meinem Guestbook ausführen könnte.....Ich machs einfach mit <img>.
Back to top
View user's profile Send private message
coach
Smarty Regular


Joined: 03 Jun 2004
Posts: 65

PostPosted: Mon Nov 29, 2004 3:58 pm    Post subject: Reply with quote

Hi,

ich würde aber die Smileys erst bei der Ausgabe ersetzen. Also in die DB ganz normal eintragen mit
Code:
;-)
und bei die Ausgabe mit einem Filter verändern und in ein Wink umwandeln.

Coach
Back to top
View user's profile Send private message
messju
Administrator


Joined: 16 Apr 2003
Posts: 3336
Location: Oldenburg, Germany

PostPosted: Mon Nov 29, 2004 6:12 pm    Post subject: Reply with quote

ich würde 2 spalten in der datenbank halten. eine mit der original-eingabe (a) und eine mit dem convertierten text und den smilies etc. (b).

wenn ein neuer eintrag erzeugt wird, kommt der nach (a) und die convertierte variante nach (b).
(warum sollte man bei jedem anzeigen der seite die sachen neu parsen/convertieren, wenn der artikel sich sowieso nicht ändert?)

wird der artikel nun bearbeite (vom admin o.ä.). so wird (a) bearbeitet und danach (b) neu erzeugt.

nur so ne idee.
Back to top
View user's profile Send private message Send e-mail Visit poster's website
coach
Smarty Regular


Joined: 03 Jun 2004
Posts: 65

PostPosted: Tue Nov 30, 2004 6:05 pm    Post subject: Reply with quote

Ist auch eine gute Idee. Würde ich sicher bei stark besucherlastigen Seiten vorziehen. Ansonsten ziehe ich natürlich KISS - Keep It Simple .. vor.

Coach
Back to top
View user's profile Send private message
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