473,721 Members | 2,103 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Opinions on Smarty

1,168 Recognized Expert Top Contributor
Hi guys,
I have been on a long journey recently learning OOP, Smarty, and a few other tricks and tools of the trade. I have however reached a crossroads on the point of whether or not I should use Smarty.
I don't mean to sound arrogant (I probably sound naive), but Smarty doesn't look like it does much that I couldn't do myself (with minimal effort) in the area of templates?
Whether I use {title} or <?php echo $title; ?> seems to be the only noticable advantage, seeing as I do both the html and php. I also imagine that the compiler is a bit more technical, but it has to be processed by php anyway, so extra parsing surely takes more time?
Do you use Smarty and what are your thoughts about template libraries?
Sep 13 '09 #1
4 1557
1,584 Recognized Expert Top Contributor
I use it, I Love it.

It's more secure syntax (than PHP's echo commnd, you never know). It's easier to manage update, change. It's got lots of great functions that I use and I can create my own modifiers in a blink of an eye. It does not slow your scripts down much at all, so performance is not an issue. It also has the ability to cache as well. (Like your homepage that doesn't change very often), you can cache it to a update every hour, on a busy server this is a performance gain, not loss.

If it was up to me, every PHP OOP MVC would use Smarty for the view. Judging by its popularity, I think it's getting there.

I've never looked back and I don't ever type echo anymore unless I'm troubleshooting something, for troubleshooting even, I usually use var_dump.
Oct 8 '09 #2
1,168 Recognized Expert Top Contributor
Great post. Thanks for that. I am becoming a 99% PHP OOP MVC kinda guy, so your confidence in it not causing a performance loss, but even possible a gain, suggests that I should spend some more time integrating it with all my future apps.
Oct 8 '09 #3
6,050 Recognized Expert Expert
I don't think I've ever used a templating library.. although, I can see the benefits.

Dan, can you elaborate on the security improvements?

TheServant, don't get too caught up with OOP - it's not an answer for everything.

Take care,
Oct 9 '09 #4
1,168 Recognized Expert Top Contributor
Thanks Mark,
It finally clicked the other day as to how I can use it and achieve what I was trying to do with my own variations for ages... But don't worry, I think it's just that honeymoon period of finding a new tool... It's like when I buy a new hammer or drill, everything starts looking like a nail or something that needs a hole...
Oct 11 '09 #5

Sign in to post your reply or Sign up for a free account.

Similar topics

by: Brian | last post by:
Hello, I am trying to work out how to have smarty use a string's contents as the display-> template.. ie: $smarty->display($buffer); obviously $buffer isn't a filename, but a smarty template inside a string variable. Take this example:
by: Daan | last post by:
Hello all, I'm having a little problem with Smarty. Getting it to work in a simple case went fine, but now I have the following situation: / /smarty /templates template.tpl /templates_c
by: Richard | last post by:
I need help. I have a smarty based program that I am modifying. I have a smarty template file that consists of smarty and HTML. I need to integrate some PHP database calls into it. My problem is I cannot figure out how to pass value between smarty and PHP. Going from php to smarty I've tried this: {php} $smarty = new Smarty; $smarty->assign("x", 100);
by: M | last post by:
Hi Folks, I am trying to install Smarty using PHP 5 on a Windows XP PC using IIS v6 The following PHP File: <!doctype html public "-//W3C//DTD HTML 4.0 //EN"> <html> <head>
by: Matt | last post by:
geez, i've done this a million times, you'd think i could get it right. uploading to production server for a new site, and part of the head.inc that starts everything up looks like this: echo SMARTY_DIR."Smarty.class.php<br>"; require_once(SMARTY_DIR."Smarty.class.php"); if (substr(phpversion(),0,1) == "4") { $smarty = new Smarty;
by: Conrad | last post by:
Hi, I'm very new to Smarty Template Engine and I'm using PHP 5.0.4 on the Windows XP Professional platform and I have the following question: When I change the 7th line of the script to use a new name and refresh the browser, it maintains the old value instead of updating to the new value. Both index.php and SmartySetup.class.php appear below: index.php:
by: ev45ive | last post by:
Hi! I have smth. like this: file.php: <?php SmartyValidate::connect($smarty); //SmartyValidate::register_form('register');
by: grezlik | last post by:
Hi! I have major problems with cakephp & smarty, (cake ver is 1.2 and smarty 2.6.18 ) there is a code (from cake/libs/view/view.php class SmartyView { .. .. ..
by: ajaymohank | last post by:
hello friends.......... i am new to smarty. can anyone please tell me how to get the value from a dynamically generated checkbox using smarty. this is the code i used... here i am generating 10 checkbox. but i am not getting the value when each checkbox is checked. the value is coming from the array $profservices. how can i get the value from each checkbox when they are selected. also i have a "Select all" checkbox generated. how will i write...
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, weíll explore What is ONU, What Is Router, ONU & Routerís main usage, and What is the difference between ONU and Router. Letís take a closer look ! Part I. Meaning of...
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.