Welcome to the GoFuckYourself.com - Adult Webmaster Forum forums.

You are currently viewing our boards as a guest which gives you limited access to view most discussions and access our other features. By joining our free community you will have access to post topics, communicate privately with other members (PM), respond to polls, upload content and access many other special features. Registration is fast, simple and absolutely free so please, join our community today!

If you have any problems with the registration process or your account login, please contact us.

Post New Thread Reply

Register GFY Rules Calendar
Go Back   GoFuckYourself.com - Adult Webmaster Forum > >
Discuss what's fucking going on, and which programs are best and worst. One-time "program" announcements from "established" webmasters are allowed.

 
Thread Tools
Old 07-27-2008, 07:00 PM   #1
Hansm
Confirmed User
 
Join Date: Jun 2002
Posts: 871
[PHP] Hard Coded versus Template Engine

What would you prefer and why?

I started a iscript and know i hear my client wants hard coded content in the PHP File.

Im trying him to change his mind but he is sure.

I disagree on this because its a total mess and not easy to work with in the further.

Just checking what people use this days. Im using template engines since 6-7 years ago.
Hansm is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 07-27-2008, 07:04 PM   #2
Linguist
Confirmed User
 
Join Date: Apr 2004
Location: Toronto, ON
Posts: 1,706
I would recommend templates. If a customer is set on hard coded content, explain to them why it's bad.

If they still insist on it - they are the customers so you have to do what they ask. If it takes longer to maintain you just charge them by the hour.
__________________
315-310
Linguist is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 07-27-2008, 07:35 PM   #3
Zorgman
Confirmed User
 
Zorgman's Avatar
 
Join Date: Aug 2002
Location: Sydney, Australia
Posts: 6,103
We're left TEVS as hard code as it gives more freedom for webmasters to change it to how they want it. Some of the things iv seen I don't think you could ever use with a template system.
__________________
---
Zorgman is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 07-27-2008, 08:17 PM   #4
drocd
Confirmed User
 
Join Date: Aug 2007
Posts: 128
Quote:
Originally Posted by Zorgman View Post
We're left TEVS as hard code as it gives more freedom for webmasters to change it to how they want it. Some of the things iv seen I don't think you could ever use with a template system.
Sounds like you've never really used a template system.
__________________
230-699
drocd is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 07-27-2008, 08:19 PM   #5
arial
Confirmed User
 
arial's Avatar
 
Join Date: Jul 2002
Location: Bay Area
Posts: 4,012
Quote:
Originally Posted by Zorgman View Post
We're left TEVS as hard code as it gives more freedom for webmasters to change it to how they want it. Some of the things iv seen I don't think you could ever use with a template system.
Wow
arial is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 07-27-2008, 08:23 PM   #6
fris
Too lazy to set a custom title
 
fris's Avatar
 
Industry Role:
Join Date: Aug 2002
Posts: 55,262
i like a template system, easy to change the design(s)
__________________
Since 1999: 69 Adult Industry awards for Best Hosting Company and professional excellence.


WP Stuff
fris is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 07-27-2008, 09:31 PM   #7
Young
Bland for life
 
Industry Role:
Join Date: Nov 2004
Posts: 10,468
1) Give them hard coded files.

2) When it's time to update charge them an hour.

3) Client Bitches

4) Tell them you'll have to re-code it for a template system

5) Charge Them 10 hours
__________________
★★★
Young is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 07-27-2008, 09:32 PM   #8
teg0
Confirmed User
 
teg0's Avatar
 
Join Date: Jan 2006
Location: Gringo in Puerto Rico
Posts: 4,197
It really depends on the amount of traffic the site is going to be getting. Template systems are costly to performance sometimes.
__________________
OV Tube - Tube Script Software
teg0 is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 07-27-2008, 10:35 PM   #9
Lane
Will code for food...
 
Join Date: Apr 2001
Location: Buckeye, AZ
Posts: 8,496
Somebody once said, PHP actually is a template system.

When you add another template system on top, you are creating an additional layer. With new syntax, additional learning curve and more limitations.

I haven't met a person who can learn a template engine syntax (like Smarty or whatever), but can't learn the php syntax.

p.s. I'm not personally against using template systems, I just have mixed feelings about it.
__________________

Last edited by Lane; 07-27-2008 at 10:36 PM..
Lane is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 07-27-2008, 11:16 PM   #10
mrkris
Confirmed User
 
Join Date: May 2005
Posts: 2,737
Quote:
Originally Posted by drocd View Post
Sounds like you've never really used a template system.
I agree.
__________________

PHP-MySQL-Rails | ICQ: 342500546
mrkris is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 07-27-2008, 11:19 PM   #11
mrkris
Confirmed User
 
Join Date: May 2005
Posts: 2,737
Quote:
Originally Posted by Lane View Post
Somebody once said, PHP actually is a template system.

When you add another template system on top, you are creating an additional layer. With new syntax, additional learning curve and more limitations.

I haven't met a person who can learn a template engine syntax (like Smarty or whatever), but can't learn the php syntax.

p.s. I'm not personally against using template systems, I just have mixed feelings about it.
PHP is a templating language, but at the same time, it doesn't prevent people from writing shitty code, such as mixing logic with display.
__________________

PHP-MySQL-Rails | ICQ: 342500546
mrkris is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 07-27-2008, 11:22 PM   #12
munki
Do Fun Shit.
 
munki's Avatar
 
Industry Role:
Join Date: Dec 2004
Location: OC
Posts: 13,393
A lot of schools of thought on this one...

Here's my take.

Good code is good code, bad code is bad code... and there's a shitload of variance in between.

Strip your function pages from your layout pages... That's just retard mode basics.

Beyond that if a templating system such as smartys is going to allow you better cache/delivery options (a lot of subsequent db calls, looping code, whatever), and quicker updates use it... If per the project it's not a necessity, why code for shit that doesn't need to be coded for?
__________________

I have the simplest tastes. I am always satisfied with the best.” -Oscar Wilde
munki is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 07-27-2008, 11:54 PM   #13
Zorgman
Confirmed User
 
Zorgman's Avatar
 
Join Date: Aug 2002
Location: Sydney, Australia
Posts: 6,103
Quote:
Originally Posted by mrkris View Post
I agree.
I have over 500 clients using over 1000 domains and not 1 complaint with my system.
Im sure those people will disagree with you - par a few.
__________________
---
Zorgman is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 07-28-2008, 04:17 AM   #14
asl
Confirmed User
 
Join Date: Jun 2003
Location: Belgium
Posts: 444
Quote:
Originally Posted by Zorgman View Post
I have over 500 clients using over 1000 domains and not 1 complaint with my system.
Im sure those people will disagree with you - par a few.
Damn I remember someone being banned from you because he wanted to change some parts in the code and wasn't able because it was hard coded and you didn't wanted to change the code or give him access to what he needed
__________________
Paysite owners: Submit your site for reviewing and touch a French audience.
asl is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 07-28-2008, 04:20 AM   #15
ro8in
Confirmed User
 
ro8in's Avatar
 
Industry Role:
Join Date: Sep 2006
Posts: 1,542
We was doing hardcoded for many years until the greatness of template engines came upon us.. And you still thinking to do hardcoded???
__________________
------
Offcourse its a dude posting here. Probably a fut ugly one too. Fuck still people falling for this 100 year old trick
ro8in is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 07-28-2008, 05:54 AM   #16
Zorgman
Confirmed User
 
Zorgman's Avatar
 
Join Date: Aug 2002
Location: Sydney, Australia
Posts: 6,103
Quote:
Originally Posted by asl View Post
Damn I remember someone being banned from you because he wanted to change some parts in the code and wasn't able because it was hard coded and you didn't wanted to change the code or give him access to what he needed
No, You failed!

He wanted the code to the admin files which we ZEND. The front end is raw (no template).
__________________
---
Zorgman is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 07-28-2008, 06:18 AM   #17
asl
Confirmed User
 
Join Date: Jun 2003
Location: Belgium
Posts: 444
Quote:
Originally Posted by Zorgman View Post
No, You failed!

He wanted the code to the admin files which we ZEND. The front end is raw (no template).
My bad
__________________
Paysite owners: Submit your site for reviewing and touch a French audience.
asl is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 07-28-2008, 07:52 AM   #18
SirMoby
Confirmed User
 
SirMoby's Avatar
 
Join Date: Jan 2003
Posts: 583
Quote:
Originally Posted by Zorgman View Post
I have over 500 clients using over 1000 domains and not 1 complaint with my system.
Im sure those people will disagree with you - par a few.
All the code that is customer presentation is hard coded and seems easy to modify as my PHP skills are lacking and I was able to make some mods. Upgrading may be a bitch but that's up to my mods and the newer version. It doesn't have to be terrible but it might be.

I don't see any reason to change the way TEVs is doing things.
__________________

Make Serious Money With Hungarian Honeys From NS Cash
SirMoby is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 07-28-2008, 08:00 AM   #19
tranza
ICQ: 197-556-237
 
Join Date: Jun 2003
Location: BRASIL !!!
Posts: 57,559
Template Engine is good!
__________________
I'm just a newbie.
tranza is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 07-28-2008, 08:06 AM   #20
Zorgman
Confirmed User
 
Zorgman's Avatar
 
Join Date: Aug 2002
Location: Sydney, Australia
Posts: 6,103
Quote:
Originally Posted by SirMoby View Post
All the code that is customer presentation is hard coded and seems easy to modify as my PHP skills are lacking and I was able to make some mods. Upgrading may be a bitch but that's up to my mods and the newer version. It doesn't have to be terrible but it might be.

I don't see any reason to change the way TEVs is doing things.
Yes, the new version will be pretty easy to upgrade too. It's mostly admin controls that are updated, but some small changes on the front are needed. I will have detailed docs to take all webmasters thought this.
__________________
---
Zorgman is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 07-28-2008, 08:11 AM   #21
dready
Confirmed User
 
dready's Avatar
 
Industry Role:
Join Date: Oct 2002
Location: Toronto, ON
Posts: 5,247
Clean smarty templates are much easier to edit if you don't understand PHP at all.
__________________
ICQ: 91139591
dready is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 07-28-2008, 09:09 AM   #22
Bird
Confirmed User
 
Bird's Avatar
 
Join Date: Jan 2005
Location: Stockton
Posts: 4,365
Templating is the way to go if your using a CMS
__________________
ICQ:268731675
Bird is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 07-28-2008, 09:42 AM   #23
Varius
Confirmed User
 
Industry Role:
Join Date: Jun 2004
Location: New York, NY
Posts: 6,890
Well Hans, I'm sure you already know my opinion

Smarty is the way I'd go for any PHP site I create. My main reasons:

- Multi-lingual sites become much cleaner/easier (esp. with a few custom hacks to the smarty class allowing you to use the {l} tag)

- Seperating code and html/design makes things cleaner and easier to work on in future.

- When you want to ship off your templates for a redesign, it's a lot easier to have a designer not screw up your few simple smarty tags than working through your php code

- WAP applications as well as other functionality is made much easier with Smarty's functions

I'm sure there are tons of other reasons I could think of if the above wasn't enough.
__________________
Skype variuscr - Email varius AT gmail
Varius is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 07-28-2008, 10:15 AM   #24
k0nr4d
Confirmed User
 
k0nr4d's Avatar
 
Industry Role:
Join Date: Aug 2006
Location: Poland
Posts: 9,228
I REALLY dislike template engines, and I prefer to create header/footer files and seperate my php code from the html as much as possible.

If a user can type {$title} in a template, they can just as easily type $row[title]. When doing loops, more people know and understand how to do them in PHP then in smarty.
k0nr4d is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 07-28-2008, 10:30 AM   #25
bDok
Confirmed User
 
bDok's Avatar
 
Join Date: Feb 2005
Location: SD/OC/LA
Posts: 1,917
there a couple questions involved before the decision of hard coded or template comes into play. There is a time and place for both.
__________________
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
Warriors come out to plaAAaayyy!
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
bDok is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 07-28-2008, 11:10 AM   #26
shadowsdrop
Confirmed User
 
shadowsdrop's Avatar
 
Join Date: Nov 2005
Location: Manila Philippines
Posts: 170
I recommend templates. It's simple and can save lots of time.
__________________
Sig too big

http://www.gofuckyourself.com/gfy_faqs.html

Want to use a large banner in your sig??? Contact Eric about getting on as an advertiser - eric AT adult.com
shadowsdrop is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 07-28-2008, 11:40 AM   #27
brandonstills
Confirmed User
 
brandonstills's Avatar
 
Join Date: Dec 2007
Location: Chatsworth, CA
Posts: 1,964
Depends on what you mean. Generally design should be separate from code. This is a basic principle of MVC that has been established as a best practice for more than a decade.

However, just because someone doesn't use a template doesn't mean they aren't separating their design from their code. There are many more ways than templates to accomplish this.

In fact, I rarely use templates because I find them very inefficient (from a development standpoint), the only exception is when I need to expose template type functionality to an end user where they will be coming up with a different design on a daily basis (like email newsletters or something).

The books "The Pragmatic Programmer" or "Code Generation" have some good ideas of other ways to go about things. I highly recommend them.
brandonstills is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 07-28-2008, 11:43 AM   #28
brandonstills
Confirmed User
 
brandonstills's Avatar
 
Join Date: Dec 2007
Location: Chatsworth, CA
Posts: 1,964
Quote:
Originally Posted by k0nr4d View Post
I REALLY dislike template engines, and I prefer to create header/footer files and seperate my php code from the html as much as possible.

If a user can type {$title} in a template, they can just as easily type $row[title]. When doing loops, more people know and understand how to do them in PHP then in smarty.
For once I agree with you.
brandonstills is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 07-30-2008, 06:45 AM   #29
jwerd
Confirmed User
 
Industry Role:
Join Date: Jun 2003
Location: Costa Rica
Posts: 1,953
Quote:
Originally Posted by brandonstills View Post
Depends on what you mean. Generally design should be separate from code. This is a basic principle of MVC that has been established as a best practice for more than a decade.

However, just because someone doesn't use a template doesn't mean they aren't separating their design from their code. There are many more ways than templates to accomplish this.

In fact, I rarely use templates because I find them very inefficient (from a development standpoint), the only exception is when I need to expose template type functionality to an end user where they will be coming up with a different design on a daily basis (like email newsletters or something).

The books "The Pragmatic Programmer" or "Code Generation" have some good ideas of other ways to go about things. I highly recommend them.
Exactly!
__________________
Yii Framework Guru - Seasoned PHP vet - Partner @ XXXCoupon.com
jwerd is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Post New Thread Reply
Go Back   GoFuckYourself.com - Adult Webmaster Forum > >

Bookmarks



Advertising inquiries - marketing at gfy dot com

Contact Admin - Advertise - GFY Rules - Top

©2000-, AI Media Network Inc



Powered by vBulletin
Copyright © 2000- Jelsoft Enterprises Limited.