Results 1 to 7 of 7

Thread: Clean Code

  1. #1

    Clean Code

    I've been making websites for a while but most of it has been with starting with a prewritten backend then modifing it from there.

    So I started to make a site for me and some friends at work to share our dvd collections. I didn't like any pre existing stuff so I started it from scratch.

    I'm pretty much done the backend in mysql/php and just working on the design but I find my code very unmanagable and hard to understand even though I wrote it. The biggest problem is the html being mixed in and out of the php.

    Need some tips guys!

  2. #2
    Templates, find a templating engine and use it. One good one for PHP I have heard is the Smarty Templating Engine. I know you want to code as much as you can from scratch, but templating frameworks generally don't contribute to the backend functionality.

  3. #3
    I've been using pog as my php template. I'm more worried about my tendency to write the html mixed in and out of the php. I spent an hour or 2 at work today cleaning it up and taking out any html in the php that didn't need to be echo'd.

    I'm just looking for some tricks to help my code look better and be as managable as possible.

    thanks for the hint anon poster. I'll definately look into smarty.

  4. #4
    Mentor
    Join Date
    May 2004
    Location
    Louisiana
    Posts
    1,206

    Books

    W.H. Here are some OSS books from a smart dude!

    http://www.phptr.com/series/series.asp?st=44315&rl=1

  5. #5
    Mentor jro's Avatar
    Join Date
    May 2004
    Location
    Pennsylvania, USA
    Posts
    1,206
    That was me on that anon post Wildheart. POG looks interesting, I am dabbling in PHP a little, I will have to play around with it more.

    Object generators are a god-send. They save an enoumous amount of time.
    jro - http://jeff.robbins.ws
    Linux counter#:213782
    GnuPG ID: 406238E7

  6. #6
    Newbie
    Join Date
    Feb 2006
    Location
    Scotland
    Posts
    1
    you may want to check out CakePHP and Symfony - a couple of nice php frameworks; I haven't used them in production yet but they are pretty nice (my background is PHP)

    not quite RoR though

  7. #7
    Mentor jro's Avatar
    Join Date
    May 2004
    Location
    Pennsylvania, USA
    Posts
    1,206
    PHP is missing a good MVC framework. Sure, I think Maverick got ported, but I think the project went stale. I hear PHP 5 is really supposed to increase the OOP aspects of PHP, any comments to that end?
    jro - http://jeff.robbins.ws
    Linux counter#:213782
    GnuPG ID: 406238E7

Similar Threads

  1. Filesystem not clean
    By llista in forum BSD
    Replies: 1
    Last Post: 03-02-2007, 01:19 AM
  2. clean install help
    By conrad5 in forum Linux - General Topics
    Replies: 13
    Last Post: 02-03-2004, 02:39 AM
  3. Mp3/Wav/Ogg Clean Up
    By stryder144 in forum General Chat
    Replies: 4
    Last Post: 02-13-2003, 08:20 PM
  4. How to clean old kernels??
    By Compunuts in forum Linux - Software, Applications & Programming
    Replies: 4
    Last Post: 03-02-2002, 06:29 PM
  5. Bin Laden Comes Clean
    By Coral_Sea in forum General Chat
    Replies: 27
    Last Post: 11-24-2001, 07:31 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •