Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

PHP Forum


You are currently viewing our PHP Forum as a guest. Please register to participate.
Login



Freelance Jobs

Reply
Is Smarty difficult to learn? Does it save development time?
Old 09-06-2008, 07:00 AM Is Smarty difficult to learn? Does it save development time?
TWD
TWD's Avatar
King Spam Talker

Posts: 1,190
Trades: 0
I like the idea of a clear seperation of presentation and logic: Smarty seems to be the ticket. But I dont know how hard it is to use or modify the templates.
TWD is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Old 09-06-2008, 10:05 AM Re: Is Smarty difficult to learn? Does it save development time?
rogem002's Avatar
PHP Chap

Posts: 843
Name: Mike
Location: United Kingdom
Trades: 0
* Gets link to smarty so everyone know what your talking about*

http://www.smarty.net/

smarty is a set of classes, if you know PHP and can understand OOP it should be fine.
__________________
My Blog/Site:
Please login or register to view this content. Registration is FREE
rogem002 is offline
Reply With Quote
View Public Profile Visit rogem002's homepage!
 
Old 09-09-2008, 03:28 AM Re: Is Smarty difficult to learn? Does it save development time?
mtishetsky's Avatar
King Spam Talker

Posts: 1,226
Name: Mike
Location: Mataro, Spain
Trades: 0
The holy war restarts.

What is the real difference between
Code:
{$somestuff}
and
PHP Code:
<?= $somestuff ?>
?
__________________

Please login or register to view this content. Registration is FREE
-
Please login or register to view this content. Registration is FREE
-
Please login or register to view this content. Registration is FREE

And don't forget to give me talkupation!
mtishetsky is offline
Reply With Quote
View Public Profile Visit mtishetsky's homepage!
 
Old 09-09-2008, 08:34 AM Re: Is Smarty difficult to learn? Does it save development time?
wayfarer07's Avatar
Poo on You

Latest Blog Post:
Introducing WowWindow
Posts: 3,987
Name: Abel Mohler
Location: Asheville, North Carolina USA
Trades: 0
The only site I've ever seen Smarty implemented on well was when I worked on http://www.jukeboxalive.com, and even then, one of the developers who was closer to the project told me he thought they were using it "retardedly". Sometimes, it comes down to nothing but a series of IF/THEN statements, along with outputting of data, which is fine, since the real guts of the logic should be separated from the template anyway, but mostly this can be handled with PHP alone.

I'd love to see a really good implementation of it, because I'm sure there is one.
__________________
I build web things. I work for the startup
Please login or register to view this content. Registration is FREE
.
wayfarer07 is offline
Reply With Quote
View Public Profile Visit wayfarer07's homepage!
 
Old 09-09-2008, 10:04 AM Re: Is Smarty difficult to learn? Does it save development time?
thehuskybear's Avatar
Ultra Talker

Posts: 362
Name: Sam
Location: Tucson, AZ
Trades: 1
I would say if you want a clear separation of logic from presentation, follow the MVC architecture.. or better yet, use a MVC based php framework.
__________________

Please login or register to view this content. Registration is FREE


Please login or register to view this content. Registration is FREE
-
Please login or register to view this content. Registration is FREE
thehuskybear is offline
Reply With Quote
View Public Profile Visit thehuskybear's homepage!
 
Old 09-09-2008, 12:43 PM Re: Is Smarty difficult to learn? Does it save development time?
Experienced Talker

Posts: 38
Name: Alan
Trades: 0
Smarty is pretty easy to use but really it is just another layer of php within the site. The smarty template engine interprets the "tags" within the template you design to display your dynamic data. It then compiles the page so that future requests for that particular page do not need to be recompiled unless the data has changed.

On sites where the data does not change frequently, it can be pretty good. If you have a large amount of data that may be presented in different ways, depending on visitor preferences, then smarty could actually cause your site to be a bit slow.
__________________

Please login or register to view this content. Registration is FREE
alhefner is offline
Reply With Quote
View Public Profile Visit alhefner's homepage!
 
Old 09-10-2008, 04:21 AM Re: Is Smarty difficult to learn? Does it save development time?
mtishetsky's Avatar
King Spam Talker

Posts: 1,226
Name: Mike
Location: Mataro, Spain
Trades: 0
OMG. Alhefner, I clearly see that you know nothing about smarty. Smarty does not compile anything. It only "compiles" the template from the form of {$somestuff} into the form of <?php echo $somestuff ?>. That's all. Nothing more.

Now once again: what is the real difference between {$var} and <?= $var ?> ?
__________________

Please login or register to view this content. Registration is FREE
-
Please login or register to view this content. Registration is FREE
-
Please login or register to view this content. Registration is FREE

And don't forget to give me talkupation!
mtishetsky is offline
Reply With Quote
View Public Profile Visit mtishetsky's homepage!
 
Old 09-10-2008, 12:23 PM Re: Is Smarty difficult to learn? Does it save development time?
VirtuosiMedia's Avatar
Web Design Made Simple

Posts: 1,228
Trades: 0
I've played around with Smarty a little, but it seems like an unnecessary layer. mtishetsky has a good point.
__________________
Want new web resources every day? - Follow me on
Please login or register to view this content. Registration is FREE


Please login or register to view this content. Registration is FREE


Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE
VirtuosiMedia is offline
Reply With Quote
View Public Profile Visit VirtuosiMedia's homepage!
 
Old 09-10-2008, 12:34 PM Re: Is Smarty difficult to learn? Does it save development time?
JeremyMiller's Avatar
WT Moderator

Posts: 1,712
Name: Jeremy Miller
Location: Las Vegas, NV
Trades: 0
Let me add my never-humble opinion. Probably the best way to address it is by their "right for me" page: http://www.smarty.net/rightforme.php

Caching
Caching is good. Caching also isn't that hard to do if you have a clue what you're doing when you're programming in PHP. AND, writing your own caching will reduce the overhead required by an entire framework.

Configuration Files
If you're building programs without these files, please go to Add/Remove programs and remove your programming tools. If you think a framework is necessary to do this, then please uninstall your tools too!

Security
Nice way of them commenting about your security. Now, go to their homepage and read about their security holes! Changing your own ability to fix security flaws out with having to wait on someone else is just foolish. Learn PHP well and the techniques and technologies necessary to code an application and your stuff will be much more secure -- while remaining under your control, so that you can fix anything you discover post de facto.

Easy To Use And Maintain
Really? You mean that if I know MVC and have it coded in PHP that learning a whole new framework's syntax is easy? I must be stoned b/c I believe it...oh wait, I'm not and I don't.

Variable Modifiers
I don't know what the hell they're talking about here, but if modifying a variable is considered hard, please repeat the uninstallation steps provided above.

Template Functions
PHP does a good job of this. Wrapper functions aren't necessary and functions necessarily create more overhead than just doing it yourself.

Filters
In PHP, these are called conditional expressions. Elementary, my dear Watson.

Resources
I had to pick myself up off the floor after reading this. Are you flipping kidding me? I have to create a resource handler to include a file? Now, you tell me, which do you think is easier?

Plugins
So, you're telling me this all-in-one framework is in pieces? Let me guess, they're all more secure than PHP itself? **** it, where's a bowl. I really need to be baked to believe this!

Add-Ons
Yeah, yeah. Add ons for Smarty only. Try finding PHP code for each of these and you'll realize that trying to find an addon for a framework is much harder to find than PHP code. Better yet, try getting help for a framework versus trying to get help for a framework.

Debugging
Ever heard of xdebug?

Compiling
Oh. Well, thank you very much. You "compile" my framework based code into PHP. How nice! I mean, I really didn't want to write PHP in PHP. I was hoping to use Vulcan. Can you "compile" that too? lol.

Performance
Oh, so given the fact that plugins and addons must be hunted down and included on-demand and that it has to search through files and convert them over to PHP which I could have coded myself -- given all that -- it does "extremely well". Sure. I'll believe that subjective analysis. lol.

Now, to answer an important question asked here:

Quote:
Originally Posted by mtishetsky View Post
The holy war restarts.

What is the real difference between
Code:
{$somestuff}
and
PHP Code:
<?= $somestuff ?>
?
The first requires 1) learning a new syntax (OK, not really as that's just PHP code without the echo), 2) a pre-parser engine to go through and do it right, and 3) that Smarty exists at least as long as PHP (a bet I'm not willing to take).

So what does "do it right" mean? Alas,

PHP Code:
<?php echo $somestuff?>
Sorry, mti, but I can't just go with your second example because short tags aren't guaranteed to be on.

So, in short, if you're not a PHP smarty, then you'll need Smarty for PHP.
__________________
Jeremy Miller

Please login or register to view this content. Registration is FREE
JeremyMiller is offline
Reply With Quote
View Public Profile Visit JeremyMiller's homepage!
 
Old 09-10-2008, 01:26 PM Re: Is Smarty difficult to learn? Does it save development time?
blackfalcon's Avatar
Skilled Talker

Latest Blog Post:
New Site: 10DollarBluRay.com
Posts: 62
Name: JuanJose H. Galvez
Trades: 0
I agree with Jeremy and others on here who are basically saying it's easier to do templating properly using PHP instead of throwing another layer on top (Smarty).

BUT...

Quote:
Originally Posted by JeremyMiller View Post
So, in short, if you're not a PHP smarty, then you'll need Smarty for PHP.
This is just it, Smarty really isn't for programmers, it's more for keeping designers out of your code. The layer smarty adds, keeps people from having to touch your code.

Here's the thing though, if all we really get out of Smarty is this new layer of separation the same job can be done VERY easily using PHP, without having to add all this extra code.

So I suppose, for those who really really really don't want to spend the small amount of time it takes to write a very simple templating system (lazy!), then Smarty could be a considered a viable option.

Also, it should be noted that Smarty has gotten popular enough where freelancers are being asked to work with it, so it might be useful to learn even if it isn't a your preferred method for templating.

Good luck whatever you decide to do,
JJ Galvez
__________________
Latest Project:
Please login or register to view this content. Registration is FREE
<--CHECK IT OUT!
My Company:
Please login or register to view this content. Registration is FREE

I'm
Please login or register to view this content. Registration is FREE
blackfalcon is offline
Reply With Quote
View Public Profile Visit blackfalcon's homepage!
 
Old 09-10-2008, 06:48 PM Re: Is Smarty difficult to learn? Does it save development time?
Skilled Talker

Posts: 74
Name: Nick Barrett
Location: Brighton
Trades: 0
If you're actually coding something in PHP, you already have the knowledge needed to remove this pointless layer. As above, it's for people who don't know PHP well/designers/etc.
__________________

Please login or register to view this content. Registration is FREE

24/7 Support | 99.5% uptime | shared | reseller | dedicated
Looking for a webhost? Try
Please login or register to view this content. Registration is FREE
!
Political Monst is offline
Reply With Quote
View Public Profile
 
Old 09-14-2008, 10:45 AM Re: Is Smarty difficult to learn? Does it save development time?
Providence's Avatar
Experienced Talker

Posts: 39
Trades: 0
Quote:
Originally Posted by TWD View Post
I like the idea of a clear seperation of presentation and logic: Smarty seems to be the ticket. But I dont know how hard it is to use or modify the templates.
back on topic: I'd say it isn't difficult as long as you know PHP
__________________

Please login or register to view this content. Registration is FREE


Please login or register to view this content. Registration is FREE


Please login or register to view this content. Registration is FREE
Providence is offline
Reply With Quote
View Public Profile Visit Providence's homepage!
 
Reply     « Reply to Is Smarty difficult to learn? Does it save development time?
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.35306 seconds with 12 queries