diff --git a/config/database.ini b/config/database.ini new file mode 100644 index 0000000..7c38f2d --- /dev/null +++ b/config/database.ini @@ -0,0 +1,7 @@ +[database] +db_driver = mysql +db_host = localhost +db_name = foo +db_username = foo +db_password = bar +filedb_storage = ./storage \ No newline at end of file diff --git a/index.php b/index.php new file mode 100644 index 0000000..2db5fa2 --- /dev/null +++ b/index.php @@ -0,0 +1,39 @@ + + * Date: 2017-12-18 + */ + +// including vendor autoloader +include_once('./vendor/autoload.php'); + +// system files +include_once('./system/config.php'); +include_once('./system/database.php'); + +// route controller +$route = ''; +if(array_key_exists('route', $_REQUEST)) { + $route = $_REQUEST['route']; +} + +if(empty($route)) { + $route = 'welcome'; +} else { + $route_names = explode('/', $route); + if(count($route) > 1) { + $route = end($route_names); + } +} + +// view render +function renderView($name) { + $viewfile = './view/' . $name . '.php'; + if(file_exists($viewfile)) { + include('./view/' . $name . '.php'); + } +} + +// including route file +include('./route/' . $route . '.php'); diff --git a/route/welcome.php b/route/welcome.php new file mode 100644 index 0000000..d881c39 --- /dev/null +++ b/route/welcome.php @@ -0,0 +1,3 @@ +$v) { + $config[$k] = $v; + } + } + } + closedir($handle); +} diff --git a/system/database.php b/system/database.php new file mode 100644 index 0000000..6d64d6a --- /dev/null +++ b/system/database.php @@ -0,0 +1,12 @@ + "SET NAMES utf8") +); +$conn->query("SET NAMES 'utf8'"); \ No newline at end of file diff --git a/vendor/autoload.php b/vendor/autoload.php new file mode 100644 index 0000000..0a76aab --- /dev/null +++ b/vendor/autoload.php @@ -0,0 +1,11 @@ +This is header
+http://github.com/gnh1201/verysimplephpframework
\ No newline at end of file diff --git a/view/template/header.php b/view/template/header.php new file mode 100644 index 0000000..482358a --- /dev/null +++ b/view/template/header.php @@ -0,0 +1 @@ +this is footer
\ No newline at end of file diff --git a/view/welcome.php b/view/welcome.php new file mode 100644 index 0000000..908a5ba --- /dev/null +++ b/view/welcome.php @@ -0,0 +1,3 @@ +Welcome! + +VerySimplePHPFramework \ No newline at end of file