Jump to content

Is WHMCS considering the abandonment of Smarty template? It seems cumbersome and obsolete.


NadalKumar

Recommended Posts

The Smarty template engine had a great run since 2002 but it is near retirement. Twig template framework from Symfony seems more robust and light weight and certainly up to date.

Why bother with a template engine anyway? It just loads in excessive files and the template file are no less cluttered with coding. If there's only one thing that the guys at Joomla got perfect, that would be their simplified template system. WHMCS should consider minimizing the code processes written within .tpl files and include a single .php file which handles conditions and pass the variable to the Smarty engine. There are too many complex loops and conditions

Example: The below code snip is too much complexity for the header.tpl. If a single processing php file existed in the template folder (like WordPress functions.php), the complex condition would be written there and the returning value passed to $smarty->assign('pageheader', $pageheader). Therefore just a single variable as {$pageheader} would be needed in the .tpl document. The same is true for most of the near 150 files in the template. Too Much!

{if !$primarySidebar->hasChildren() && !$showingLoginPage && !$inShoppingCart && $templatefile != 'homepage' && !$skipMainBodyContainer}
{include file="$template/includes/pageheader.tpl" title=$displayTitle desc=$tagline showbreadcrumb=true}
{/if}

 

Link to comment
Share on other sites

  • 4 weeks later...

@WHMCS John I really hope you guys are getting with the trend. The "smarty" thing is about at end-of-life and being the leading web host billing app, you should be caught with deprecated vendor systems.

This article titled "Once upon a time there was Smarty!" from WAY back in 2008 was written by a developer who used and wrote a book on the Smarty template technology, yet by the time of the post he had already left it and suggests that it is just a bulky and unnecessary engine. https://hasin.me/2008/01/05/once-upon-a-time-there-was-smarty/

From the article

Quote

I think now its time to say there is no need to use an external template engine like smarty. With flexible view in MVC frameworks like CodeIgniter and CakePHP (Many others too) is there really any need to learn a separate template language like smarty?

...that time is over. Seriously why the hell I need to learn a new templating language when a “echo” does the thing much better.

I seriously don’t think there is need of Smarty anymore. Its dead! If you guys don’t agree with me, you can spend hell lot of time learning that {$name} actually does what you could do with “echo $name”. If you write a dispatcher which is smart enough to bring the variables from a controller scope to the scope of a view, why do u need to learn a separate parser like smarty? Moreover, of course it takes time in parsing the template files into equivalent PHP code and cost me some time. But hell no, I am not pointing to those microseconds I lost in extra parsing, I am pointing to the time I will spend learning smarty which is not needed at all. Learning all those functions, loops, logics, caching and others in smarty takes so much time that I would love to suggest you to learn writing efficient PHP code in template layer rather than learning something like smarty.

Come on John, get the team up to speed with modernity. I know it would be quite a lot of changes but it is worth the time. Heck I'd even volunteer my time to get it done. Blesta is threatening to steal your flame!

Link to comment
Share on other sites

6 hours ago, NadalKumar said:

Blesta is threatening to steal your flame!

Fairly sure you haven't actually looked at that product's system. This is just a really small portion of a template (I won't link to their site) to include the header and/or login, and that's not using twig.

<div class="row<?php echo (!$this->Html->ifSet($show_header, true) ? " login" : "");?>">

Here's WHMCS' version

{include file="$template/includes/head.tpl"}
{$headoutput}

I'd suggest that the current system is simpler and less prone to syntax errors. I dealt with twig on a shopping cart implementation not long ago, and it's not at all simple, with double curly braces and % signs and so on. I'd say it's no less complex or more robust than Smarty. It's just newer.

Link to comment
Share on other sites

12 hours ago, bear said:

 


{include file="$template/includes/head.tpl"}
{$headoutput}

<div class="row<?php echo (!$this->Html->ifSet($show_header, true) ? " login" : "");?>">

It's just newer.

You chose to focus on one idea and not the POINT of the original post so here it is in large print to clarify.

" Why bother with a template engine anyway? "

Try reading ALL of a post.

Edited by WHMCS ChrisD
Rule 2 - Behaviour on the Community - We expect all users to be friendly and polite. While we understand that users will disagree and have different points of view at times, this can be communicated in a civil manner
Link to comment
Share on other sites

 
 
 
9 hours ago, NadalKumar said:

" Why bother with a template engine anyway? "

Why use Smarty

Apart from that, don't forget that source code of WHMCS is obfuscated so basically there's no other choice. Moreover there's a pretty big community of developers and designers constantly working on hundreds of modules and templates. Having a template engine allows everyone to "play" using the same rules. Not to mention newbies that can easily get decent results by using Smarty. Most people aren't even able to understand ternary operators. With Smarty they don't need to bother too much.

As I said in other threads you opened, it's not all black and white. What is good for Wordpress doesn't necessarily have to be good for WHMCS and vice versa. Decisions should be based on each case and not on trends.  You ask why WHMCS uses Smarty and not Twig or just PHP. I could continue asking why does it use FontAwesome and not Glyphicons or Iconicons? Why Laravel and not mysqli, PDO? Why Boostrap and not Angular?

At the end of the day WHMCS can't make everyone happy. For example I hate Laravel for the same reason you hate Smarty. I think that Laravel is unnecessary but it helps newbies with SQL so I accept it but stick with 😘 PDO.

Link to comment
Share on other sites

This thread is now closed for new replies at this time.

In accordance with the WHMCS.Community Guidelines with a particilar note to Rule 2. different points of view can be communicated in a civil manner, members of the community should not attack or insult each other nor is there any need to make use of large text in an effort to belittle other users.

 
 
 
 
3
On 7/09/2016 at 8:55 PM, WHMCS ChrisD said:

2. Behaviour on the Community

  1.  We expect all users to be friendly and polite. While we understand that users will disagree and have different points of view at times, this can be communicated in a civil manner
  2.  Please do not post rude, insulting or inflammatory posts. Personal attacks, name-calling and insults will not be tolerated on WHMCS.Community.
  3. Profanity and inappropriate images (including porn or gross violence) may not be posted anywhere on the WHMCS.Community.
  4. WHMCS.Community Staff & Moderators use their sole discretion as to what is deemed unacceptable behaviour in the community and may remove content at any time.
  5.  Your posts assist other users, please do not delete content if you find an answer, please share this solution to help other users.
Link to comment
Share on other sites

Guest
This topic is now closed to further replies.
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use & Guidelines and understand your posts will initially be pre-moderated