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 tags im eigenen plugin

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


Joined: 27 Dec 2014
Posts: 3

PostPosted: Sat Dec 27, 2014 7:37 am    Post subject: smarty tags im eigenen plugin Reply with quote

moin leute

ich habe vor für ein projekt ein block plugin zu schreiben
primär für mehrsprachigkeit ({lang}login.button{/lang} output=absenden...)

da ich innerhalb des blocks nun if abfragen und co verwenden will also z.b.

tpl: {lang}header.welcome{/lang}
php: $language['header.welcome'] = '{if $user == 0} Hallo Gast {else}Hallo {$user}{/if}';

stehe ich nun vor einem problem

es ist ansich kein problem den inhalt zwischen {lang} und {/lang} zu ersetzten

sobald ich darin dann variablen abrufen will oder ein if abfragen will wird dieses nicht ersetzt, ich bekomme einfach nur '{if $user == 0} Hallo Gast {else}Hallo {$user}{/if}' zurück geworfen


kennt jemand eine lösung für das problem?
wäre für jede hilfe dankbar

MfG
Back to top
View user's profile Send private message
U.Tews
Administrator


Joined: 22 Nov 2006
Posts: 5068
Location: Hamburg / Germany

PostPosted: Sat Dec 27, 2014 10:53 am    Post subject: Reply with quote

Smarty kompiliert nur die Template Source. Dynamische Inhalte mit Smarty Tags in Variablen und der Output von Plugins wird werden nicht kompiliert.

Es gibt zwar das {eval} Plugin mit dem dieses möglich ist aber die Seite bekommt dadurch eine sehr schlecht Performance da jedesmal der Compiler aufgerufen wird.

Du solltest also Deine If Abfrage in deinem PHP Script machen und den entsprechenden Text Deiner $language variablen zuweisen.
Back to top
View user's profile Send private message
Stricted
Smarty n00b


Joined: 27 Dec 2014
Posts: 3

PostPosted: Sat Dec 27, 2014 2:47 pm    Post subject: Reply with quote

danke für deinen post

ich habe mir das eval plugin nun angesehen und das ganze in einem block plugin nachgebaut, bisher ist es noch performant, ich werde das ganze mal im auge behalten aber bisher gefällt mir die lösung sehr gut da nun alles dynamisch läuft


MfG
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