[PHP] Hard Coded versus Template Engine

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Hansm
    Confirmed User
    • Jun 2002
    • 871

    #1

    [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
    Confirmed User
    • Apr 2004
    • 1706

    #2
    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

    Comment

    • Zorgman
      Confirmed User
      • Aug 2002
      • 6103

      #3
      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.
      ---

      Comment

      • drocd
        Confirmed User
        • Aug 2007
        • 128

        #4
        Originally posted by Zorgman
        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

        Comment

        • arial
          Confirmed User
          • Jul 2002
          • 4012

          #5
          Originally posted by Zorgman
          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

          Comment

          • fris
            Too lazy to set a custom title
            • Aug 2002
            • 55679

            #6
            i like a template system, easy to change the design(s)
            Since 1999: 69 Adult Industry awards for Best Hosting Company and professional excellence.

            Comment

            • Young
              Bland for life
              • Nov 2004
              • 10468

              #7
              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
              ★★★

              Comment

              • teg0
                Confirmed User
                • Jan 2006
                • 4204

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

                Comment

                • Lane
                  Will code for food...
                  • Apr 2001
                  • 8496

                  #9
                  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, 09:36 PM.

                  Comment

                  • mrkris
                    Confirmed User
                    • May 2005
                    • 2737

                    #10
                    Originally posted by drocd
                    Sounds like you've never really used a template system.
                    I agree.

                    PHP-MySQL-Rails | ICQ: 342500546

                    Comment

                    • mrkris
                      Confirmed User
                      • May 2005
                      • 2737

                      #11
                      Originally posted by Lane
                      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

                      Comment

                      • munki
                        Do Fun Shit.
                        • Dec 2004
                        • 13393

                        #12
                        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

                        Comment

                        • Zorgman
                          Confirmed User
                          • Aug 2002
                          • 6103

                          #13
                          Originally posted by mrkris
                          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.
                          ---

                          Comment

                          • asl
                            Confirmed User
                            • Jun 2003
                            • 444

                            #14
                            Originally posted by Zorgman
                            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.

                            Comment

                            • ro8in
                              Confirmed User
                              • Sep 2006
                              • 1542

                              #15
                              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

                              Comment

                              • Zorgman
                                Confirmed User
                                • Aug 2002
                                • 6103

                                #16
                                Originally posted by asl
                                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).
                                ---

                                Comment

                                • asl
                                  Confirmed User
                                  • Jun 2003
                                  • 444

                                  #17
                                  Originally posted by Zorgman
                                  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.

                                  Comment

                                  • SirMoby
                                    Confirmed User
                                    • Jan 2003
                                    • 583

                                    #18
                                    Originally posted by Zorgman
                                    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

                                    Comment

                                    • tranza
                                      ICQ: 197-556-237
                                      • Jun 2003
                                      • 57559

                                      #19
                                      Template Engine is good!
                                      I'm just a newbie.

                                      Comment

                                      • Zorgman
                                        Confirmed User
                                        • Aug 2002
                                        • 6103

                                        #20
                                        Originally posted by SirMoby
                                        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.
                                        ---

                                        Comment

                                        • dready
                                          Confirmed User
                                          • Oct 2002
                                          • 5247

                                          #21
                                          Clean smarty templates are much easier to edit if you don't understand PHP at all.
                                          ICQ: 91139591

                                          Comment

                                          • Bird
                                            Confirmed User
                                            • Jan 2005
                                            • 4365

                                            #22
                                            Templating is the way to go if your using a CMS
                                            ICQ:268731675

                                            Comment

                                            • Varius
                                              Confirmed User
                                              • Jun 2004
                                              • 6890

                                              #23
                                              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

                                              Comment

                                              • k0nr4d
                                                Confirmed User
                                                • Aug 2006
                                                • 9231

                                                #24
                                                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.
                                                Mechanical Bunny Media
                                                Mechbunny Tube Script | Mechbunny Webcam Aggregator Script | Custom Web Development

                                                Comment

                                                • bDok
                                                  Confirmed User
                                                  • Feb 2005
                                                  • 1917

                                                  #25
                                                  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!
                                                  =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=

                                                  Comment

                                                  • shadowsdrop
                                                    Confirmed User
                                                    • Nov 2005
                                                    • 170

                                                    #26
                                                    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

                                                    Comment

                                                    • brandonstills
                                                      Confirmed User
                                                      • Dec 2007
                                                      • 1964

                                                      #27
                                                      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.

                                                      Brandon Stills
                                                      Industry and programming veteran
                                                      [email protected] | skype: brandonstills | ICQ #495-171-318

                                                      Comment

                                                      • brandonstills
                                                        Confirmed User
                                                        • Dec 2007
                                                        • 1964

                                                        #28
                                                        Originally posted by k0nr4d
                                                        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.

                                                        Brandon Stills
                                                        Industry and programming veteran
                                                        [email protected] | skype: brandonstills | ICQ #495-171-318

                                                        Comment

                                                        • jwerd
                                                          Confirmed User
                                                          • Jun 2003
                                                          • 1953

                                                          #29
                                                          Originally posted by brandonstills
                                                          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

                                                          Comment

                                                          Working...