Attention guru's!

I build sites with XHTML, CSS, PHP, MySQL and tend to re-use code from previous sites I've built to speed things up.

However, I wonder what tools or trickery you folks use to speed up the process. I'm convinced its the forms in my CMS that slow my production / efficiency down.

Like, I tend to build sites, using one db connection file, two includes(header / footer), take content from the db, use one CSS file, one area for images etc.
But I'm sure I could be doing things a lot quicker.

Also I'm on the look-out for any examples of PHP OOP.
I seem to be creating forms and the validation all the time, when I'm sure I could just re-use 'classes'.

And ways to make my code more 'modular' so I can move it across and re-use it on another site without making too many changes.

Your advice will doubtless be invaluable.


Any help would be fab!
Thanks

Dani AI

Generated

Short, practical plan to speed builds and make your code portable.

As already suspects, forms are often the friction point. Two simple rules: make small, focused building blocks you can copy between projects, and push configuration out of the code so the same classes work in different sites. is right that scaffolding/generators can save time — treat generated code as a starting point and tidy it — and is right about snippets: use them, but pair snippets with a real reusable library so you do not copy-and-paste fixes later.

Concrete things to extract now

  • Project skeleton: public, src, config, templates, vendor. One bootstrap file that wires an autoloader and reads env config.
  • DB: one PDO wrapper with prepared statements and simple query methods (no global connections).
  • Forms: a tiny Validator/Form class that accepts a rules array and returns errors.
  • Templates: partials for form fields so markup is consistent.
  • Workflow: keep this skeleton in a repo, use it as the base for new projects, and publish shared classes as a private package you can require.

Minimal Validator pattern (example usage)

$rules = ['email'=>'required|email','password'=>'required|min:8'];
$v = new Validator($_POST,$rules);
if ($v->passes()) { /* save user via UserModel */ } else { $errors = $v->errors(); }

Troubleshooting notes and cautions

  • Always validate server-side even if you use client-side checks.
  • Avoid globals and direct file includes for config; use environment variables or a single config file.
  • When using code generators, scan generated SQL and HTML for security and performance issues.
  • Extract slowly: start by moving the DB wrapper and validator into a shared library, then refactor forms to use those classes.

Doing this consistently saves hours on every new site and makes future changes trivial.

Recommended Answers

All 3 Replies

Anyone? Anyone? Bueller?

Really wouldn't mind some tips from the pro's here. Ways you speed up the web site build process. Techniques or maybe even online tools. Anything :) Thank you.

check out dbQwikSite. Commercial PHP code generator for databases. Speeds up development a lot.
www.dbQwikSite.com

FYI, we are the makers of this product.

commented: nice site... +2

im not an expert but I know dreamweaver has snippets that allow you to store sections of code and use that code across different sites

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.