PHP Code in .tpl Datei

Hier können Probleme und alles andere in Deutscher Sprache gelöst werden.
Post Reply
Christian.K
Regular
Posts: 9
Joined: Thu Mar 01, 2007 7:49 am

PHP Code in .tpl Datei

Post 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
garvinhicking
Core Developer
Posts: 30022
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Re: PHP Code in .tpl Datei

Post 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
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
Christian.K
Regular
Posts: 9
Joined: Thu Mar 01, 2007 7:49 am

Post 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
garvinhicking
Core Developer
Posts: 30022
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Post by garvinhicking »

Hi!

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

Viele Grüße,
Garvin
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
Christian.K
Regular
Posts: 9
Joined: Thu Mar 01, 2007 7:49 am

Post 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
Post Reply