AW: [Templates] TT and PHP
[prev]
[thread]
[next]
[Date index for 2005/02/25]
Hi Steve,
Yes, that's correct, I'm looking for a way to convert (some parts of ) TT (=
eg. [ FOREACH and IF ] ) to PHP. Our PHP templates are very similar to TT-Te=
mplates,=20
TT:
[% IF myvar =3D=3D 3 %] myvar is three [% ELSE %] myvar is not three [% END=
%]
PHP:
<? if($myvar =3D=3D 3) { ?> myvar is three <? } else { ?> myvar is not three=
<? } ?>
FOREACH Statement looks similar
What do you mean by MVC type sollution? As far as I've understood MVC ( Mode=
l-View-Controller ), we are already doing this by splitting
The app-logic from templates and from our data, that is to be displayed.
Thanks
Denis
"THINK THE WEB WAY."
---------------------------------------------------
NCM - NET COMMUNICATION MANAGEMENT GmbH
---[ Denis Banovic - CTO
mailto:denis.banovic@xxx.xx
---[ M=FChlstrasse 4a
AT - 5023 Salzburg
Tel. 0662 / 644 688
---[ Fax: 0662 / 644 688 - 88=20
http://www.ncm.at
---------------------------------------------------
-----Urspr=FCngliche Nachricht-----
Von: Steve Peters [mailto:steve@xxxxxxxxxxx.xxx]=20
Gesendet: Donnerstag, 24. Februar 2005 18:38
An: Denis Banovic
Cc: templates@xxxxxxxxxxxxxxxx.xxx
Betreff: Re: [Templates] TT and PHP
Hi Denis,
Essentially, then, you are looking to convert TT to PHP. My guess is that
it can't be done with a simple regexp since the various tags do not=20
do a full one-to-one match from TT to PHP. =20
Have you tried looking into a MVC type solution where you could easily use
TT and PHP as separate parts of an overall application?
Steve Peters
steve@xxxxxxxxxxx.xxx
On Thu, Feb 24, 2005 at 06:04:52PM +0100, Denis Banovic wrote:
> Hi Teddy,
>=20
> I know that in TT you can change the TAG-Styles from [% %] to anything yo=
u want, but the Syntax is still a bit different in PHP and TT.
>=20
> What I'm searching for, is a regex or module, that would convert "[% IF E=
LSIF ELSE END %]" and
> [% FOREACH END %] statement to PHP, that's all.
>=20
> I just wanted to know, if someone has already done this before?
>=20
> Thanks
>=20
> Denis
>=20
>=20
> -----Urspr=FCngliche Nachricht-----
> Von: Octavian Rasnita [mailto:orasnita@xxx.xx]=20
> Gesendet: Donnerstag, 24. Februar 2005 16:33
> An: Denis Banovic
> Cc: templates@xxxxxxxxxxxxxxxx.xxx
> Betreff: Re: [Templates] TT and PHP
>=20
>=20
> Ok, in TT you can work using other's templating systems styles, including
> "PHP style".
>=20
> You can find more information in the TT manual.
>=20
> Teddy
>=20
> Teddy
>=20
> ----- Original Message -----=20
> From: "Denis Banovic" <denis.banovic@xxx.xx>
> To: "Octavian Rasnita" <orasnita@xxx.xx>
> Cc: <templates@xxxxxxxxxxxxxxxx.xxx>
> Sent: joi, 24 februarie 2005 16:36 PM
> Subject: AW: [Templates] TT and PHP
>=20
>=20
> Hi!
>=20
> The problem is, I need it to work in PERL and in PHP! And it would be gre=
at
> if I could use the my TT-Syntax
>=20
> Thanks
>=20
> Denis
>=20
> -----Urspr=FCngliche Nachricht-----
> Von: Octavian Rasnita [mailto:orasnita@xxx.xx]
> Gesendet: Donnerstag, 24. Februar 2005 14:42
> An: Denis Banovic
> Betreff: Re: [Templates] TT and PHP
>=20
>=20
> Hi,
>=20
> You should use Smarty templating system with PHP.
>=20
> Teddy
>=20
> ----- Original Message -----=20
> From: "Denis Banovic" <denis.banovic@xxx.xx>
> To: <templates@xxxxxxxxxxxxxxxx.xxx>
> Sent: Thursday, February 24, 2005 3:26 PM
> Subject: [Templates] TT and PHP
>=20
>=20
> Hi!
>=20
> I was just wondering if anyone already tried to interpret TT-Templates in
> PHP?
>=20
> My problem is, that I have webspaces where we are using both, perl and ph=
p
> tools, and the tools are using the same
> Header/Footer files.
>=20
> This works great as long as the Header/Footer are static files. But when=
our
> designers / customers want to put some dynamic content into the
> Header/Footer, I have a problem.
>=20
> I've wrote some regexes that work well, when I just need to insert some f=
ile
> or variable content:
>=20
> E.g this works well for [% INCLUDE myfile.htm %]
>=20
> preg_match_all("/\[\%\s*INCLUDE\s*\"(.*?)\"\s*\%\]/", $cc, $matches);
> foreach ($matches[1] as $file) {
> $cont =3D $this->load_file($file);
> $cc =3D preg_replace("/\[\%\s*INCLUDE\s*\"$file\"\s*\%\]/", $cont, $cc);
> }
>=20
>=20
> But it would be great to have a support for a normal "IF ELSIF ELSE END"=
and
> FOREACH statement.
>=20
> Has anyone done already something like this? Or is there a module that ca=
n
> process that?
>=20
> Thanks
>=20
> Denis
>=20
> "THINK THE WEB WAY."
> ---------------------------------------------------
> NCM - NET COMMUNICATION MANAGEMENT GmbH
> ---[ Denis Banovic - CTO
> mailto:denis.banovic@xxx.xx
> ---[ M=FChlstrasse 4a
> AT - 5023 Salzburg
> Tel. 0662 / 644 688
> ---[ Fax: 0662 / 644 688 - 88
> http://www.ncm.at
> ---------------------------------------------------
>=20
>=20
>=20
>=20
>=20
> ____________
> Virus checked by G DATA AntiVirusKit
> Version: AVK 15.0.2702 from 26.01.2005
> Virus news: www.antiviruslab.com
>=20
>=20
> _______________________________________________
> templates mailing list
> templates@xxxxxxxxxxxxxxxx.xxx
> http://lists.template-toolkit.org/mailman/listinfo/templates
>=20
>=20
> ____________
> Virus checked by G DATA AntiVirusKit
> Version: AVK 15.0.2702 from 26.01.2005
> Virus news: www.antiviruslab.com
>=20
>=20
> ____________
> Virus checked by G DATA AntiVirusKit
> Version: AVK 15.0.2702 from 26.01.2005
> Virus news: www.antiviruslab.com
>=20
>=20
> _______________________________________________
> templates mailing list
> templates@xxxxxxxxxxxxxxxx.xxx
> http://lists.template-toolkit.org/mailman/listinfo/templates
>=20
____________
Virus checked by G DATA AntiVirusKit
Version: AVK 15.0.2702 from 26.01.2005
Virus news: www.antiviruslab.com
_______________________________________________
templates mailing list
templates@xxxxxxxxxxxxxxxx.xxx
http://lists.template-toolkit.org/mailman/listinfo/templates
 |
(message missing)
|
 |
 |
AW: [Templates] TT and PHP
Denis Banovic 10:07 on 25 Feb 2005
|