GoFuckYourself.com - Adult Webmaster Forum

GoFuckYourself.com - Adult Webmaster Forum (https://gfy.com/index.php)
-   Fucking Around & Business Discussion (https://gfy.com/forumdisplay.php?f=26)
-   -   [PHP] Hard Coded versus Template Engine (https://gfy.com/showthread.php?t=844059)

Hansm 07-27-2008 07:00 PM

[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.

Linguist 07-27-2008 07:04 PM

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.

Zorgman 07-27-2008 07:35 PM

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.

drocd 07-27-2008 08:17 PM

Quote:

Originally Posted by Zorgman (Post 14518686)
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.

arial 07-27-2008 08:19 PM

Quote:

Originally Posted by Zorgman (Post 14518686)
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 :1orglaugh:1orglaugh:1orglaugh:1orglaugh

fris 07-27-2008 08:23 PM

i like a template system, easy to change the design(s)

Young 07-27-2008 09:31 PM

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

teg0 07-27-2008 09:32 PM

It really depends on the amount of traffic the site is going to be getting. Template systems are costly to performance sometimes.

Lane 07-27-2008 10:35 PM

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.

mrkris 07-27-2008 11:16 PM

Quote:

Originally Posted by drocd (Post 14518814)
Sounds like you've never really used a template system.

I agree.

mrkris 07-27-2008 11:19 PM

Quote:

Originally Posted by Lane (Post 14519126)
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.

munki 07-27-2008 11:22 PM

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?

Zorgman 07-27-2008 11:54 PM

Quote:

Originally Posted by mrkris (Post 14519209)
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.

asl 07-28-2008 04:17 AM

Quote:

Originally Posted by Zorgman (Post 14519258)
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 :error

ro8in 07-28-2008 04:20 AM

We was doing hardcoded for many years until the greatness of template engines came upon us.. And you still thinking to do hardcoded???

Zorgman 07-28-2008 05:54 AM

Quote:

Originally Posted by asl (Post 14519634)
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 :error

No, You failed!

He wanted the code to the admin files which we ZEND. The front end is raw (no template).

asl 07-28-2008 06:18 AM

Quote:

Originally Posted by Zorgman (Post 14519889)
No, You failed!

He wanted the code to the admin files which we ZEND. The front end is raw (no template).

My bad :pimp

SirMoby 07-28-2008 07:52 AM

Quote:

Originally Posted by Zorgman (Post 14519258)
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.

tranza 07-28-2008 08:00 AM

Template Engine is good!

Zorgman 07-28-2008 08:06 AM

Quote:

Originally Posted by SirMoby (Post 14520392)
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.

dready 07-28-2008 08:11 AM

Clean smarty templates are much easier to edit if you don't understand PHP at all.

Bird 07-28-2008 09:09 AM

Templating is the way to go if your using a CMS

Varius 07-28-2008 09:42 AM

Well Hans, I'm sure you already know my opinion :winkwink:

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.

k0nr4d 07-28-2008 10:15 AM

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.

bDok 07-28-2008 10:30 AM

there a couple questions involved before the decision of hard coded or template comes into play. There is a time and place for both.

shadowsdrop 07-28-2008 11:10 AM

I recommend templates. It's simple and can save lots of time.

brandonstills 07-28-2008 11:40 AM

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 07-28-2008 11:43 AM

Quote:

Originally Posted by k0nr4d (Post 14520963)
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. :)

jwerd 07-30-2008 06:45 AM

Quote:

Originally Posted by brandonstills (Post 14521280)
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! :thumbsup:thumbsup


All times are GMT -7. The time now is 06:54 PM.

Powered by vBulletin® Version 3.8.8
Copyright ©2000 - 2025, vBulletin Solutions, Inc.
©2000-, AI Media Network Inc