<?php //-------------------------------------------------------------------------------------------------------------| // suppose the url is this: // http://mr-potatoes.com/testframework/forums/add/post // real URL btw. and this is 'kinda' how it's done on my framework. // which is actually zend's framework. just broken down and simplified // // http://mr-potatoes.com /testframework /forums /add /post // SEVER_NAME /BASE_FOLDER /MODULE /CONTROLLER /ACTION // // a little description here first. // / [BASE_FOLDER] - the base folder is the site. // / [MODULE] - another part of the hierarchy. a module can be forums, blog or whatever other // / application tickles your dick // / [CONTROLLER] - this is where we are. if we are in a forum the 'add' would be make a new post. // / or the controller could be 'SHOWFORUMS' which is also in turn your index. it is // / the 'page' you are on // / [ACTION] - this is the action that you are doing on that page. posting, or deleting or // / whatever else tickles your facy //-------------------------------------------------------------------------------------------------------------| // CaptureUrl is a dummy function. it returns an array of whatever the URL contained. it would be delimited by // the '/' abd sent back. therefore it would contain: // $array[0] = testframework // $array[1] = forums // $array[2] = add // $array[3] = post // it would not return the server name as that is not important. if someone were to try to hack that shit we // would just check to make sure that the URL given and the actual host are the same. then return. if there // is nothing return null $Url = CaptureUrl(); $Controller = null; $Action = null; else if ($Url[2] != null) { $Class = $Url[2]; $Controller = new $Class; // now our object class is instantiated to the 'forums' class that we have created elsewhere. } else if ($Url[3] != null) { $Action = $Url[3]; // now the $action == a string. this string is the one that we plan to use to make the // function call. or the ACTION call } if ($Controller != null) { // if there is an action then we do that. otherwise we call the edfault action (index) if ($Action != null) { $Controller->$Action(); } else { $Controller->Index(); } } //-------------------------------------------------------------------------------------------------------------| // Let me make sure that you understand that this is NOT good code and this is NOT how i am doing my framework. // the idea is very much the same. i'm in a while loop, i'm doing real error checking and it's real sexy. // // now, for this example i'm using one thing. FORUMS and ADD and POST. not the best way to do this of course. // so we'll go through the conditionals and then once we are doing we call the function. it better exist, if // not the site will crash but right now who cares? this is an idea of how this bitch works. so, once the // function is called we do whatever is in there. // // BAM! it's done. // // what i'm trying to do with this is that once it gets all the info from the URL i will call a C++ class // and function (after i get the namespace ;)) and then i would take over from there. that is the idea. //-------------------------------------------------------------------------------------------------------------|?>