Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 54083
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 10, 20262026-05-10T17:09:52+00:00 2026-05-10T17:09:52+00:00

Other than standard OO concepts, what are some other strategies that allow for producing

  • 0

Other than standard OO concepts, what are some other strategies that allow for producing good, clean PHP code when a framework is not being used?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. 2026-05-10T17:09:52+00:00Added an answer on May 10, 2026 at 5:09 pm

    Remember: MVC, OOP and tiers are design concepts, not language constructs, nor file-structuring.

    For me, this means that when not using a framework, and when there’s not different teams for programming and designing; there’s no value in using another template system on top of PHP (which is a template language). Also, separating code from layout doesn’t necessarily mean doing it on different files.

    This is how i used to do for one-off, seldom expanded, PHP web apps:

    1. write a ‘general utilities’ file, there i put some formatting/sanitising functions, as well as a few DB access functions:
      1. getquery(): given a SQL, returns a result object
        • getrecord(): given a SQL, returns a record object (and closes the query)
        • getdatum(): given a SQL, returns a single field (and closes the query)
        • put all configurations (DB access, some URL prefixes, etc) on a ‘config.php’ file
        • write a model layer, either one file, or one for each object you store on DB. There, will be all the SQL constants, present a higher-level API, based on your conceptual objects, not on DB records.

    that’s your ‘framework’, then you write the ‘presentation’ layer:

    1. one PHP file for each page, starts with some simple code to fetch the objects needed, followed by HTML with interspeced PHP code, just to ‘fill in the holes’. with very few exceptions, the most complex code there should be for loops. I make a rule to use only one-liners, the ?> should be in the same line as the opening <?php

      • each data-entry form should point to a small PHP without any HTML, that simply get’s the POST data, enters into the DB, and forwards to the calling page.

    and that’s it. If working alone, it has all the separation of intents you need, without drowning in a lot of files for a single user action. Each page as seen by the user is managed by a single PHP file.

    It’s even easy to maintain, after a few months without looking at the code, since it’s easy to test the app, taking note of the filenames in the URL field of the browser. This guides you directly to the relevant code.

    (nowadays, of course, i’m using Django for almost everything…)

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 66k
  • Answers 66k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • added an answer You can do it with just metadata, there's a good… May 11, 2026 at 11:25 am
  • added an answer Go to Tools --> Options --> Text Editor --> CSS… May 11, 2026 at 11:24 am
  • added an answer For latex, use the inputenc option: \usepackage[utf8]{inputenc} Instead of utf8,… May 11, 2026 at 11:24 am

Related Questions

Other than standard OO concepts, what are some other strategies that allow for producing
Other than self.class.send :method, args... , of course. I'd like to make a rather
Other than pasting a WDSL in the tech spec, what are the recommended ways
Other than using raw XML, is there an easy way in .NET to open
Other than for app launch shortcuts, which should only be provided by the O/S,
Other than pencil & paper? I found freemind, the mapping tool very useful. Any
Other than the fact that ASP.NET MVC Web Application has more clarity in its
Other than the Java language itself, you have to learn the java framework. Similiar
Which browsers other than Firefox support Array.forEach()? Mozilla say it's an extension to the
I mean other than using it when required for functions, classes, if, while, switch,

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.