• We’re currently investigating an issue related to the forum theme and styling that is impacting page layout and visual formatting. The problem has been identified, and we are actively working on a resolution. There is no impact to user data or functionality, this is strictly a front-end display issue. We’ll post an update once the fix has been deployed. Thanks for your patience while we get this sorted.

Question for those who have built their own PHP sites.

I'm attempting to use my newfound knowledge to build a completely new site from scratch. It's simply intended as a learning tool for myself, nothing I plan to commercialize. However, I'm finding it difficult at times to properly work step by step through building everything. I'm constantly questioning myself as to what I'm working on next. I also wonder if my current plan of action is "normal", where I'm basically trying to code the basics of everything, then go back and tighten everything up, from ELSE errors/redirects to better security to the design of the website itself.

I know it's an open-ended question, but how do you guys usually tackle a new site? I'm wondering if the site I'm working on might be a bit much for just one person, but I've always thought big 🙂. Thanks for any commentary on the subject.
 
Well, you have to tell us what the site is first. It all really depends on what you want to do and how you plan on doing it.

I have built my own CMS from scratch with MySQL and PHP. It wasn't too huge of an undertaking.

One of the most important things about programming in general is having a vision of what you want to accomplish. Once you know what you want to do, then you can start figuring out how you want to do it. Once you figure out how you want to do it, then you can start attacking it in pieces.
 
Originally posted by: reverend boltron
One of the most important things about programming in general is having a vision of what you want to accomplish. Once you know what you want to do, then you can start figuring out how you want to do it. Once you figure out how you want to do it, then you can start attacking it in pieces.

QFT...programming is all about problem solving. First you need to plan what you need to do to solve the problem (the problem in a general sense being your lack of a website in this case), then do it in phases or pieces.

For instance at work, we design the site first. Once that is approved, we start writing functionality and database functions. Then we do back-end admin controls.

 
I agree with the above two posters. You need a solid plan that details what you want to accomplish and after having this it makes it easier to tackle the problem and solve it.

The first thing I do with my websites is figure out the database requirements and schema and create that. After that I usually get a general site layout thought of and create that (usually use someone's three-column liquid CSS layout) and get the basic color theme together. Then it's on to implementing features piece-by-piece.
 
Originally posted by: reverend boltron
Well, you have to tell us what the site is first. It all really depends on what you want to do and how you plan on doing it.

I have built my own CMS from scratch with MySQL and PHP. It wasn't too huge of an undertaking.

One of the most important things about programming in general is having a vision of what you want to accomplish. Once you know what you want to do, then you can start figuring out how you want to do it. Once you figure out how you want to do it, then you can start attacking it in pieces.

The site I'm working on is a type of CMS as well, albeit highly specialized towards the subject matter I'm working with. I was mainly wondering if others typically did the meat of the code first, then clean up security and design issues later, or if design was paramount, then you coded around that, etc.

The method I'm taking right now is that I designed my basic layout for each type of page I'll have, and simply have graphic placeholders everywhere, with generic text. Once I get the basic code to where I want it, I'll go back through and attempt to clean it up a bit, working on security and streamlining it to the best of my ability. Then I'll head back to the CSS and finish up the design around what my code adds to the page.

Just curious how others tackled stuff like this, and if I was wrong in my methodology in how I approached it. Since I'm 100% self-taught at this point, I have no reference point on how to "correctly" build a site, although I'm sure there is no one correct way.
 
For security, it should be something you're thinking about with every line of code you write. It's far easier to write secure code once, then to write messy code and have to redo huge portions because it's not very secure. What's the point of writing a bunch of DB queries that are subject to SQL injection if you are just going to have to rewrite them later? For the most part security is all about discipline while coding.
 
I usually section the work up and then go at it each section at a time being as thorough and complete as possible as I go along. Security and code efficiency is always a priority through each step. I try not to leave anything for later.

The way I usually work on a project is like this:

1) First, everything I can think of that the website will feature goes down on paper in a sort of rough draft form. The entire site is roughed out including any sections/modules, login, dynamic features, etc.

2) Then I go to design and start doing mockups in a graphics program. I'll do a mockup for every unique type of page but here I will use placeholders for text and general images where needed, but not graphic details like buttons, borders etc. Graphic detail the site will use will all be worked out at this time and as complete as possible.

3) Next I do a home page and begin working on the security and overall backend. I always break up the home page into into modules to be used for the rest of the site: global, header, menu, footer, login (if used), etc. This I will do to maximum completion because from there, for the most part, it is just making new sections and working on stand alone modules.
 
I am working on a web development using php course at the college where I work. I preach the test cases. Break your code up into unit tests and write code that passes the tests, the path becomes much more clear when you work that way. When I have 'real' work I use this method. I usually create classes/methods/functions that meet the tests laid down, then I just format the output to look pretty.
 
Functions, lots of functions. Chop the site up into small pieces that may get re-used and put them in something like functions.php and include that file. (login script, date, whatever)

And, like the first few people said, figure out what you want first or you will be writing your code in circles.
 
Originally posted by: 911paramedic
Functions, lots of functions. Chop the site up into small pieces that may get re-used and put them in something like functions.php and include that file. (login script, date, whatever)

And, like the first few people said, figure out what you want first or you will be writing your code in circles.

thats the advice i gave a cousin about a year ago.

6 months later when he came to me and showed me his first "php masterpiece"
it was one index file that included a functions.php, had dozens of mod rewrites and a big spaghetti mess of conditionals with nothing but oddly named functions

i'm certainly a fan of re-using code
but in order to learn the best way of code management, you need to retype it a few times 😛
 
Back
Top