Monday, December 9, 2013

How To make your own Framework

Creating a website is linking multiple files. Html /. Php /. Asp so as one course to follow the rules of the applicable website development. Making the website at that time using conventional means (I think) by making each template for each file. So join in the design and programming of the file, and then repeated again for the next file so on for all the files.

Many frameworks are available on the internet there are Cake, Prado, etc.. To recognize such a framework requires more effort and ability, when there is a change of developer we also have to update our knowledge.

There are several concepts in making one of
them is framework MVC (Model View Controller).

MVC itself is a programming concept that separates the programming logic with presentation applications, for making a good php frameworks that do not take a minute. This time I want to try to address the "embryo" of his course in building their own framework using Model View Controller concept.


Input All the component of program
<? session_start();
include_once(‘config.php’);
include_once(‘./mycore/inc/classpaging.php’);
include_once(‘./mycore/inc/functions.php’);
include_once(‘./mycore/inc/upload.inc.php’);
include_once(‘./mycore/inc/form_functions.php’);
include_once(‘./mycore/inc/table_functions.php’);
include_once(‘./mycore/inc/render.class.php’); ?>
do checking authority to call the files that exist in the framework

<? //—————————————————
// Check untuk autority user, if haven't login,
//—————————————————
//—————————————————
//—————————————————
// including basic system functions
// and specific modul functions, file to be opend
//—————————————————
// check variabel pemanggilan file
if (isset($_GET['_mod']) || isset($_GET['task'])) {
$_mod    = isset($_GET['_mod'])?$_GET['_mod']:$home_module;
$task    = (!isset($_GET['task']))?’index’:$_GET['task'];
}else {
$_mod    = isset($_POST['_mod'])?$_POST['_mod']:$home_module;
$task    = (!isset($_POST['task']))?’index’:$_POST['task'];
}

$mod_url  = “index.php?_modul=$_mod”;
$file_url = “index.php?_modul=$_mod&file=$task”;
#system core module programing
if (file_exists(“./programming_modul/$_mod/system.class.php”)) {
#echo “sukses”;
require(“./
programming_modul/$_mod/system.class.php”);
}
//—————————————————
//Module Access Check…………………………..
if (file_exists(“./programming_modul/$_mod/access.php”)) {
require_once(“./
programming_modul/$_mod/access.php”);
}else{
$module_access = false;
}
// file template
require(‘./template/’.$default_theme.’/index.php’);
?>
Above is the core of the development of the framework itself is simple. The entire programming entry in the module folder. templates into the template folder, so that each separate programming of website templates and terms of file management will also be easier for us if it will update the system and programming structure. How to file his calling was to be changed, for example:
index.php?_modul=registrasi&file=newproject
explain that we access the registration module to create a new file
In conventional programming will call like this:
http://localhost/website/newproject.php

No comments:

Post a Comment