Page 1 of 1

Creating a Reusuable Framework (With Updates)

Posted: Sat Sep 08, 2007 11:28 am
by Zoxive
I've been working on a framework that utilizes my first MVC, for myself, that i want to be able to use in all my new projects, which is fine. Now the problem comes to i want to be able to update these as i make the framework better, and fix bugs along the way.

I figure the best way would to use SVN and just check out the framework in each website directory and then just "update" them using svn. What do you think about this?

Now heres once place i get stuck, should i be storing the "Config" in a file and then have the framework check if that file exists and then include it? or store it in the database?

And how about more functionality, i can't just go in and change stuff in the framework per project, because the next update will just write back over it. So again i can have the framework check and see if files exist and include them, or maybe i can extend the classes some how.

Right now the directory is something like..

Code: Select all

www/              #root
  mvc/            #Framework Root
    class/        #Classes for Framework
    tpl/          #Default Template Files When No Template Folder Found
    controllers/  #Controllers To load Should i have it here? or in www/controllers?
    main.php      #Includes Classes, Defines, and Starts Sessions
  tpl/            #Framework Looks in here for other Template Files if Exists
  index.php       #Will need to make this for each Project(See Below)
index.php Would Look something like..

Code: Select all

/**
 *  All Pages are "Processed" Though this page
 *    index.php?controller=$1&action=$2&more=$3
*/

// Include MVC Main includes.
// I could now include all Custom Classes, functions, properties that are needed.
include('mvc/main.php');

// Call MVC Dispatch Has optional Params
// I can Call an Extended MVC Controller if i need/make one
MVC::dispatch();
Any recommendations/comments/help appreciated.

PS (Just typing this up helped a lot)

Posted: Sat Sep 08, 2007 4:09 pm
by Christopher
I tend to put the config in the same location as the index.php or bootstrap.php. That way it is both site specific and isolated from the library code.

Re: Creating a Reusuable Framework (With Updates)

Posted: Sun Sep 09, 2007 4:37 am
by kyberfabrikken
Zoxive wrote:I figure the best way would to use SVN and just check out the framework in each website directory and then just "update" them using svn. What do you think about this?
Sounds like the right thing to do. You might want to separate framework (reusable code) from application, in separate repositories. You can check them out in different places, or you can use the external feature of svn.
Zoxive wrote: Now heres once place i get stuck, should i be storing the "Config" in a file and then have the framework check if that file exists and then include it? or store it in the database?
Putting config in the database, sounds like trouble to me. Just put the config in a php-file, and leave it close to the bootstrap, or even in the boostrap. As Christopher suggested.
Zoxive wrote: PS (Just typing this up helped a lot)
Funny how that works, isn't it?