Page 1 of 1

PHP Code in .tpl Datei

Posted: Fri Mar 02, 2007 10:17 am
by Christian.K
Wie kann ich einen PHP Code in einer tpl Datei ausführen?

z.B.:

Code: Select all

<?php echo date('Y'); ?>
MfG Christian

Re: PHP Code in .tpl Datei

Posted: Fri Mar 02, 2007 11:32 am
by garvinhicking
Hi!

Das brauchst Du eigentlich nicht, da es für solche Dinge Smarty-Code gibt:

http://smarty.php.net/manual/en/languag ... format.php

Ansonsten schau mal hier:
http://www.s9y.org/78.html

Grüße,
Garvin

Posted: Fri Mar 02, 2007 12:40 pm
by Christian.K
Ich habe vor dem posten meiner Anfrage bereits im Google gesucht. Aber weil ich nichts gefunden habe, wendete ich mich an dieses Forum.

Wie soll der Code dann lauten, damit ich das selbe Ergebnis erhalte wie unter PHP

Code: Select all

<?php echo date('Y'); ?>
MfG Christian

Posted: Fri Mar 02, 2007 1:08 pm
by garvinhicking
Hi!

Siehe: http://smarty.php.net/manual/en/languag ... format.php, da sind Beispiele enthalten.

Viele Grüße,
Garvin

Posted: Fri Mar 02, 2007 1:15 pm
by Christian.K
Ich habs gefunden:

der PHP

Code: Select all

<?php echo date('Y'); ?>
in Smarty für die tpl Datei lautet dann also:

Code: Select all

{$smarty.now|date_format:"%Y"}
Danke, mfg Christian