Jump to content

Recommended Posts

I'm trying to create a minimalistic site engine that I can use for my future projects. I know there's a long way to go before it will be complete, but I am in no hurry.

 

Now to my first question, the code below is a basic structure of my thoughts so far, but I would like to know if this is a good way to do it?

 

The $modules->render('position'); is intended to load multiple modules, wich contains both html and php code. I have a list in my mysql db to know in wich position each module should load in, and there's also a priority column, if there's more than 1 module in a position. When a module from my list is loaded, the module file is included and executed.

 

All this leads us to my second question, should I use ob_start(); before outputting the modules, or is there a much more smarter way of doing this? I'm also having no clue on how to handle custom vars that is beeing sent to each module, because I can't send $_GET['pageid'] etc. to 2 modules at the same time, wich I want to be able to do, because I will in the future implement ajax features.

 

I hope that somebody will understand my questions and give me a nice understandable reply! Thank you in advance!

 

<?php
function __autoload( $ClassName )
{
require_once( $ClassName . ".php" );
}
$db = new db; // contains a database wrapper
$core = new core; // core functionality
$modules = new modules; // load active modules and renders them
?>

<html>
<body>

<div id="container">
    <div id="header">
        <?php $modules->render('header'); ?>
    </div>
    <div id="left">
        <?php $modules->render('left'); ?>
    </div>
    <div id="main">
        <?php $modules->render('main'); ?>
    </div>
    <div id="footer">
        <?php $modules->render('footer'); ?>
    </div>
</div>

</body>
</html>

Link to comment
https://forums.phpfreaks.com/topic/159103-small-site-engine-design-questions/
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.