Yea was thinking about that yesterdayghost007 wrote:The idea was to include backend php in my private classes and only use frontend in the pages that will output info to the user.
e.g. index php will include frontend.php and use createobject when it needs for example the user.class.php also.
in the user.class.php I will include only the backend.php and include other classes that I need separately e.g. include mysql.class.php also because I connect to DB.
I thought this would make the code more portable as this was my only objective by using this structure.
I use baseObject instead of backend, and basePage instead of front end
But it's basically what you'er talking about
Then each page has a default db connection, header, footer, session, userSession, and maybe some other stuff.
Then each page is laid out as below. So the page itself becomes an object.
This is moving towards the M$ .net framework incase you haven't seen it before.
Code: Select all
<?
# ---------- start code behind ---------- #
include_once 'basePage.php';
class Page(basePage)
{
function __construct()
{
// construct the page ... using other functions and objects etc ..
}
// other functions ....
}
$page = new Page(); // instantuate the page above.
# ----------- end code behind ----------- #
?>
<html><body>
... rest of page layout here, such as:
<a href="<? echo $page->somelink ?>">home</a>
<table>
</body></html>