Re: general question about smarty
| From: | Wolfram Kriesing | Date: | Wed, 23 May 2001 16:36:15 +0000 |
| Subject: | Re: general question about smarty | ||
| References: | 1 | Groups: | php.smarty.general |
| Request: | Send a blank email to php-smarty-general+get-799@lists.php.net to get a copy of this message | ||
> Although I don't really imagine this happening in "real Life" T, if
you have a
> web site written with Smarty and suddenly want to have it written in
Java, the
> translation to Velocity will not be a huge work (the translation of
the
> underlying programming logic can be...)
well, i see php more as the language for rapid prototyping, if a concept
has proven to be good and this application becomes something really
kicking we will switch to the java world, therefore i think that happens
in real life
> With a template system you have a real separation between the logic
(that
> creates the data), the data vehicle (an array) and the data display
system (the
> template)
> If you change completely the logic, as long as the array is the same..
> absolutely no problem
ok, makes sense, but still it's not very convincing
if you are changing the logic that much that the data you show will
become completely different you will also have to change the html page
i just have to come back to this example:
------------using php----------------
<?php
$res = $myClass->myGetMethod( $someId );
?>
some html here
<?php print($res["valueName"]) ?>
or may be like this
<?php print($res->valueName) ?>
and some more html here
----------------------------
------------using smarty----------------
some html here
{RES_VALUENAME}
or may be like this
{RES_VALUENAME}
and some more html here
----------------------------
even the call " $res = $myClass->myGetMethod( $someId ); "
can go in another file, which i actually also do currently
so the only real difference then is the "print" in php-tags instead of
"{}"
> A very little example (without any real interest but its just for the
example):
> For my web site I build some parts using XML that is more convenient
for me and
> allows me to learn XML, then once I'm happy with the result, in some
case I
> write down a database version.
> With Smarty this is of absolutely no problem there is no logic in the
interface,
> all the logic is in the pure php file, as long as the array produced
is the
> same... the way its produced has no importance.
since i also have split the logic into class-files, as i know it from
java/jsp/etc. and oop in general there is no logic in the html file
itself neither, it's just the printing in the html is done using the
php-tags and functions
> You can't loop through data in a HTML page... so you'll be stuck to
static data
foreach, while, ... - lets me loop too
the only diff is i use the php syntax and not smarty, which has sections
which also loops through variable content
> Note : I'm unable to answer to question 4 (that seems to make a lot of
sense)
can someone, because i think that gets more to the point, doesnt it?
thanks
wolfram kriesing