Norman in 't Veldt
Moderator OpenCart Forums
_________________ READ and Search BEFORE POSTING _________________
Our FREE search: Find your answer FAST!.
[How to] BTW + Verzend + betaal setup.

note: refresh of this page will result in different times ... it seems that the test is live.
http://www.raintpl.com/PHP-Template-Engines-Speed-Test/
and
http://gonzalo123.wordpress.com/2011/01 ... omparison/
This rain template engine is not all that bad and haanga is smarty alternative.
(Please correct me if I'm wrong that opencart uses it's own template engine.)
I'd be interested in seeing how much overhead would be added or reduced by tweeking or replacing the current opencart template engine. So, which sucks more?
Smarty and other template engines uses their own code syntax however, django does too and I've seen very little complaining about that.
Is there a benefit to going to a template syntax?
As a coder - no since you can just drop in your php tags.
Is it simpler? no, because you have to learn the syntax.
They why?
Because, it is a syntax that designers can use and are used to.
But php is a template engine!
To be honest, where did the heck does that come from?
P = personal
H = home
P = page
.. = tools
Personal Home Page Tools ...PHP/fi
Which was just a bunch of cgi perl scripts to act like SSI insertions and made life much easier than working with perl which really is a pain when you insert stuff from outside files like a calling a function or class, well back in the day it was.
At the moment Perl6 and PHP6 are gaining the same reputation. As Larry Wall would say, it will happen when it is ready.
But this bit about php is a template engine is moot since opencart is using one

930sc ... because it is fun!
1.) I have noticed that. Merits and Demerits on that. Unless Daniel is the super all around jock, and does the Bo Jackson. I'd say that sometimes it is better to go 3rd party.Qphoria wrote: 1- Daniel likes to keep as much as possible in-house
2- Native php is more powerful
3- Native php is faster
4- a template engine is just another language to learn
IF that were to be true then why did he write, "I can make the page controller us the template class. Using that method means you can swap in and out the template class with the smarty one." ?
2.) Well, yeah

3.) Not entirely true. Cache and hardware play a large share in this.
native php loses to rain tpl and is not much faster than haanga.
Here's a link that adds pure php to the mix
http://gonzalo123.wordpress.com/2011/01 ... plain-php/
I do agree that Native PHP is faster but opencart is using a template engine ala Daniel.
4.) Yep, I did state that too. But it is just a syntax and carries between projects. So, if opencart did use smarty or django syntax people will come in with less to learn than they will now.
The reason I'm interested in this is that there is always room for improvement and benefits that could be gained by going with a 3rd party solution. Take a look at the myriad of projects that do

930sc ... because it is fun!
But that assumes they already know smarty.. I looked at smarty... to me it was more complex than normal php. If a person can learn smarty they can learn phpSapporoGuy wrote: 4.) Yep, I did state that too. But it is just a syntax and carries between projects. So, if opencart did use smarty or django syntax people will come in with less to learn than they will now.
OpenCart commercial mods and development http://spotonsolutions.net
Layered Navigation
Shipment Tracking
Vehicle Year/Make/Model Filter
system/engine/controller.php
system/library/template.php
Semantics, which is causing our different view points.
I am not saying that opencart uses any type of template engine syntax. I am just saying that it has a template engine albiet very simple in terms of functionality.
Or am I wrong?
Now compared to rain, rain just offers a few syntax codes while Haanga or smarty goes way way into template engine land.
Although ... Using a template engine as in smarty or other is not for everybody, it does offer a wide scale appeal compared to your typical I need xyz function because I'm selling twiggy wiggies.
930sc ... because it is fun!
So, I still don't get this php is a template engine unless you mean that perl and python are template engines too?
930sc ... because it is fun!
That's why I suggested something like PHPTAL in another thread. It's not just an opinion. It has one big advantage over the others and that's that it uses XML style placeholders so that designers can see what their page will actually look like without having to know PHP or without having to install OC on a server just to test their work.Qphoria wrote:Smarty, django, rain, haanga.... template engines are like opinions...
Something like this would open the door to more designers than we could shake a stick at, which can only be a good thing for OC. Personally, I hate being forced to code my HTML by hand. I wish I could use Dreamweaver to design my templates for OC, but it's useless because all I see in design view is a blank page with some PHP graphic tags where the code is.
I don't know why, but as a group, we seem to be so opposed to something like this. Sure, PHP is fantastic! I can hardly put the book down that I'm reading. But it's not good for "designing" HTML pages. Why not use the right tool for the job? When building a house, you use a hammer. But how long would it take to paint the house with that hammer? (Alright, that's probably not the best metaphor, but hey... it's still early here

I really hope that the powers-that-be reconsider their position on this and implement a way to make it easier to design with graphic apps like Dreamweaver.
OpenCart v1.4.9.4
VQMod | Categories Home | Cleaner By Default - 2 Column | Speak Good English
as far as the tepmplate.php being a template engine have a look into it it's a very short file and as I said all it does is extract the data array and include the .tpl file which will then get interpreted as straight php with no translation neededed.
Sapporo seems like your big concern is caching you've been pounding the forums in every possible way looking for some way to do more caching, but there is no need to add an extra translation layer just to get caching. Besides opencart is fairly efficient and most of the stuff that would be a big problem is cached. Do you have a client that is running a fortune 500 site on it or something where complete caching would really make that much of a difference?
OpenCart commercial mods and development http://spotonsolutions.net
Layered Navigation
Shipment Tracking
Vehicle Year/Make/Model Filter
You could offer a controller switch to use the current way or template engine.
I do recommend rain for simple TE and haanga or twig since you can change tags.
I'm still on the fence for phptal ... Would like to see comparison speed numbers and cache integration.
Pounding the forums???
A few post here and there, on topic, no tangents ... And you consider that pounding the forums?
Oh please!
As for caching, some other people might also be interested in speed and performance beyond what we get now. Besides with more jquery happening, a few microseconds might help.
930sc ... because it is fun!
OpenCart commercial mods and development http://spotonsolutions.net
Layered Navigation
Shipment Tracking
Vehicle Year/Make/Model Filter
I'm going to get more info on this, but here's what the PHPTAL web site says:Xsecrets wrote:well I have no idea of speed on phptal...
Also, if anyone is interested, here's a good write up on it from a graphic designer's perspective:PHPTAL is fast thanks to compiled templates and fine-grained caching. Makes it easy to generate well-formed XML/XHTML (protected against XSS attacks). PHPTAL's code is mature and improving. Released free under LGPL.
http://inside.webfactory.de/en/blog/tem ... hings.html
OpenCart v1.4.9.4
VQMod | Categories Home | Cleaner By Default - 2 Column | Speak Good English
Would be interesting to know whether there are any serious disadvantages or limitations to using Smarty as opposed to the OpenCart templates. E.g. could it really translate something as simple like this into Smarty:Qphoria wrote:But that assumes they already know smarty.. I looked at smarty... to me it was more complex than normal php. If a person can learn smarty they can learn phpSapporoGuy wrote: 4.) Yep, I did state that too. But it is just a syntax and carries between projects. So, if opencart did use smarty or django syntax people will come in with less to learn than they will now.
Code: Select all
<?php if ($logged) { ?>
<a href="<?php echo str_replace('&', '&', $logout); ?>" class="button" style="text-decoration:none;"><span><?php echo $button_logout; ?></span></a>
<a href="<?php echo str_replace('&', '&', $account); ?>" class="button" style="float:right;text-decoration:none;"><span><?php echo $button_account; ?></span></a>
<?php } ?>
Code: Select all
<div id="navigation">
<?php echo file_get_contents( HTTP_SERVER.'index.php?route=common/menus&logged='.$logged ); ?>
</div>
One of the advantages of Smarty is language independence, e.g. it could be used in C-sharp, Java servlets, and others, if I remember it correctly. But for the OpenCart software I don't see the point of adding pieces of code written in other languages to the system. And in real life, we'd end up mixing PHP with Smarty in the templates in quite a few places.
Export/Import Tool * SpamBot Buster * Unused Images Manager * Instant Option Price Calculator * Number Option * Google Tag Manager * Survey Plus * OpenTwig
OpenCart commercial mods and development http://spotonsolutions.net
Layered Navigation
Shipment Tracking
Vehicle Year/Make/Model Filter
Well, OpenCart templates usually aren't pure XHTML, they frequently contain embedded PHP sections, for displaying variables, or for conditional statements or loops. Smarty is supposed to be able to do all of this using its own non-PHP syntax, if I remember correctly.Xsecrets wrote:Don't really see what either of those code snippets have to do with smarty they are both pure php.
Export/Import Tool * SpamBot Buster * Unused Images Manager * Instant Option Price Calculator * Number Option * Google Tag Manager * Survey Plus * OpenTwig
OpenCart commercial mods and development http://spotonsolutions.net
Layered Navigation
Shipment Tracking
Vehicle Year/Make/Model Filter
From the top of my head:JNeuhoff wrote:
E.g. could it really translate something as simple like this into Smarty:
Code: Select all
<?php if ($logged) { ?> <a href="<?php echo str_replace('&', '&', $logout); ?>" class="button" style="text-decoration:none;"><span><?php echo $button_logout; ?></span></a> <a href="<?php echo str_replace('&', '&', $account); ?>" class="button" style="float:right;text-decoration:none;"><span><?php echo $button_account; ?></span></a> <?php } ?>
Code: Select all
<a href="{$logout|escape}" class="button" style="text-decoration:none;"><span>{$button_logout}</span>
<a href="{$account|escape}" class="button" style="float:right;text-decoration:none;"><span>{$button_account}</span></a>
Here is another fragment from the address.tpl just for fun
Code: Select all
{$header}{$column_left}{$column_right}
<div id="content">
<div class="top">
<div class="left"></div>
<div class="right"></div>
<div class="center">
<h1>{$heading_title}</h1>
</div>
</div>
... lines removed here...
{foreach from=$addresses item=address)}
{if ($address.address_id == $default)}
<tr>
<td width="1"><input type="radio" name="address_id"
value="{$address.address_id}" id="address_id[{$address.address_id}]"
checked="checked" style="margin: 0px;" /></td>
<td><label for="address_id[{$address.address_id}]"
style="cursor: pointer;">{$address.address}</label>
</td>
</tr>
{else}
<tr>
<td width="1"><input type="radio" name="address_id"
value="{$address.address_id}"
id="address_id[{$address.address_id']"
style="margin: 0px;" />
</td>
<td><label for="address_id[{$address.address_id}]"
style="cursor: pointer;">{$address.address}</label>
</td>
</tr>
{/if}
{/foreach}
Well, there are other engines available like Open Power Templates and Twig, just to mention two "compiling" ones.
Twig has just been started, OPT has been around for some time and Smarty for ages.
Markku
Users browsing this forum: No registered users and 6 guests