Reply to Re: [PHP] Re: php style guides

Your name:

Reply:


Posted by Jochem Maas on 10/04/08 11:05

Jason Barnett wrote:
> Tim Burgan wrote:
>
>> Hi everyone,
>>
>> What 'rules' do you follow about styling/formatting your PHP code? Do
>> you follow a guide that is available online?
>
>
> <sacred_cow_warning>Please do not flame me here, different strokes for
> different folks!</sacred_cow_warning>

:-)

>

....

>
> And that's fine. The main thing is: aim for consistency of your coding
> standards. That way when you look through an entire project it's easy
> to see what's going on.

thats probably the best advice so far!

....

>
> Personally I don't mix and match HTML with my PHP code. I am extremely
> lazy and enjoy finding PHP code available that will do all of the
> echo'ing for HTML I want to build. The PEAR package HTML_Quickform is a

I am pretty good at PHP and I have tried using the HTML_Quickform
package, I thought it was a nightmare. don't get me wrong the idea is
great! It took me days to get a form working that ammounted to a very
simple comment/email form, something that should take very little time
as it is (and the idea of the package is to speed this kind of thing up).

AFAIKT HTML_Quickform excels at abstracting complex, multipage forms but
its got a steep learning curve.

I DO NOT RECOMMEND BEGINNERS USING IT, first fully understand the
concepts and problems that HTML_Quickform trys to address then give it a
shot to see if it meets your need.

<I-DONT-CARE-IF-YOU-FLAME-ME>
That was my personal opinion, if it hurts your feels flame on,
you will be ignored ;-)
</I-DONT-CARE-IF-YOU-FLAME-ME>

> good example here; it solves a common problem (building an MVC form) for
> me in a way that is faster than coding it all out by hand. That is,
> once you know how to use the package. (There are loads of other
> packages out there as well; this is but one example.)
>
> But if you look at your HTML as a template (which it pretty much is) for
> your front end and you view PHP as your logic back-end (which it is)
> then mixing them together is fine. Separating presentation and logic is
> generally a good idea; this way you can easily change the way it looks

oh boy, talk about opening a can or worms :-)

> without breaking functionality (or vice versa). Although if/when I do
> it this way I try to make it pretty obvious what I'm trying to accomplish.
>
> <html>
> <head><?php include 'functions.php'; ?></head>
> <body>
> <h1><?php getHeader1(); ?></h1>
> <h2>Hello <?php getUserName(); ?>! How are you doing this fine day?</h2>
> </body>
> </html>
>

that is a nice example of using well named functions (goes for
classes,vars,constants,etc as well) to make your code transparent

>
>

[Back to original message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация