Welcome Guest, Not a member yet? Register   Sign In
CMS idea
#1

[eluser]Unknown[/eluser]
I have an idea for how to structure a CMS and I was looking for feedback on its practicality and usefulness.

system process (pseudo-code):
Code:
user access url: www.test.com/page/1 (page is for page module and 1 is the page id)

routing routes the uri to a default controller

default controller loads config file for page module (it selects using the uri, the contents of the file are shown below for simplicity)

the config variable are parsed and all data is retrieved from database

data from database is arranged into an array for template parsing

template is parsed and outputted

config file for page module (i understand this is the no code forum but this is the easiest way to demonstrate this example):
Code:
<?php
$config = array(
            'centre' => array(
                            array(
                                'type'=>'dynamic',
                                'function'=>'page::load_current',
                                    )
                    ),    
        );
?>
centre denotes the section, it can be anything like 'left-bottom-box' or whatever suits your needs
type denotes how the content is retrieved, if static the content is defined in the array if dynamic then the content is retrieved from a function of a model
function denotes the model and the function, it is provided in namespace format (unless i can think of a better way to do it)

please note this is a very simple example, this can be extended to allow preprocessing of post and get variables and the calling of library functions e.g.:
Tank-auth module, login example:
Code:
<?php
$config = array(
            'preprep' => array(
                            array(
                                'vars'=>array('username','password'),
                                'rules'=>array(array('trim|required'), array('trim|required')),
                                'function'=>'tank_auth::login'),

                                    )
                    ),    
        );
?>
vars denotes the variables inputted via post or get (you know what i mean)
rules are validation rules in CI format
function is the library and function in namespace format

I understand that my idea is incomplete and i am not claiming this is the new way to move forward or anything, i just want feedback from more experience coders on flaws and problems that may occur when trying to put this together.

My main worry is speed as I can imagine that parsing larger config files can cause large slowdowns and also i have built a working prototype using the 'page' example and i have profiled it and it doesnt seem great to me.
Code:
Loading Time: Base Classes      0.0792
Parse      0.0496 (parsing of config file and generation of content)
Controller Execution Time ( Welcome / Index )      0.1038
Total Execution Time      0.1833

Notes:
Machine is a 1.8GHz Amd Sempron, 2.25GB RAM, Windows 7 SP1
Server software is XAMPP 2.5
Usual background apps running such as firefox, aptana, winamp etc.




Theme © iAndrew 2016 - Forum software by © MyBB