Lets Go MVC
class route_module
{
//OUR MODULE CLASS ROUTER,, STACK AND STAGE OR BUILD MORE TO WORK WITH AS A ALPHANUMERIC TREE//
//IF MOD=NAME CALL CLASS GET MODULE OR CALL MULTIPLE MODULE CLASSES AND MULTIPLE CLASS PAGE ROUTERS TOO//
//YOU MAY REQUIRE A PATH FROM THIS CLASS ROUTER TO ANOTHER CLASS ROUTER IN SUCCESSION-->//
//--> EXAMPLE INDEX.PHP?MOD=GROUPS&MOD2=GROUPACTIVE&PAGE=ACTIVEGROUPS&DATA=123456 ETC.//
function routeModule()
{
//include('../a1/config.php');//FOR MODULE 1 PUBLIC CONFIG FILE INCLUSION//
// redirect if user is not valid and will not allow them on any protected files or pages listed below//
//include('../c2/auth_user.php');
//include('../c3/pm_count.php');
if(isset($_GET['mod']))
{
$mod = htmlspecialchars($_GET["mod"]);
//protected router includes c1/controllers above views-parts where needed.//
if($mod == 'home')
{
include('./m1/class_home.php');
$home = new route_home;
$home->routeHome();
}
if($mod == 'wall')
{
include('../m2/class_wall.php');
$wall = new route_wall;
$wall->routeWall();
}
if($mod == 'friends')
{
include('../m3/class_friends.php');
$friends = new route_friends;
$friends->routeFriends();
}
if($mod == 'groups')
{
include('../m4/class_groups.php');
$groups = new route_groups;
$groups->routeGroups();
}
if($mod == 'mailbox')
{
include('../m2/class_mailbox.php');
$mailbox = new route_mailbox;
$mailbox->routeMailbox();
}
if($mod == 'albums')
{
include('../m2/class_albums.php');
$albums = new route_albums;
$albums->routeAlbums();
}
if($mod == 'videos')
{
include('../m2/class_videos.php');
$videos = new route_videos;
$videos->routeVideos();
}
//ADD MORE module classes HERE//
}else{
//OUR DEFAULT CLASS OR STATIC MODULE CLASS CAN BE PLACED HERE//
include('./m1/class_home.php');
$home = new route_home;
$home->routeHome();
}//end if set
}//end function
};//end class
//TO CALL THIS CLASS ON the main INDEX.PHP. CONFIG IS AUTOMATICALLY INCLUDED.//
//$module = new route_module;
//$module->routeModule();
No comments:
Post a Comment