From bc261ebc2a9f109fa2bb03151ab5c502617b4761 Mon Sep 17 00:00:00 2001 From: Robert Date: Thu, 24 Jul 2025 19:45:28 -0400 Subject: [PATCH] init 4 --- protected/src/configs/on_CodeHydrater.php | 31 ++++++++++++ protected/src/configs/on_view_mode.php | 9 ++++ protected/src/controllers/app/home_ctrl.php | 50 +++++++++++++++++++ protected/src/routes/routes.php | 17 +++++++ protected/src/templates/main.php | 35 +++++++++++++ protected/src/views/default/app/footer.php | 18 +++++++ protected/src/views/default/app/header.php | 14 ++++++ .../src/views/default/app/home_index.php | 11 ++++ public/index.php | 2 +- 9 files changed, 186 insertions(+), 1 deletion(-) create mode 100644 protected/src/configs/on_CodeHydrater.php create mode 100644 protected/src/configs/on_view_mode.php create mode 100644 protected/src/controllers/app/home_ctrl.php create mode 100644 protected/src/routes/routes.php create mode 100644 protected/src/templates/main.php create mode 100644 protected/src/views/default/app/footer.php create mode 100644 protected/src/views/default/app/header.php create mode 100644 protected/src/views/default/app/home_index.php diff --git a/protected/src/configs/on_CodeHydrater.php b/protected/src/configs/on_CodeHydrater.php new file mode 100644 index 0000000..8832107 --- /dev/null +++ b/protected/src/configs/on_CodeHydrater.php @@ -0,0 +1,31 @@ + 'Testing Project', + 'short_url' => true, + 'default_project' => 'home', + 'check_HTML_tags' => true, + 'live' => $is_live, +)); \ No newline at end of file diff --git a/protected/src/configs/on_view_mode.php b/protected/src/configs/on_view_mode.php new file mode 100644 index 0000000..8840b9d --- /dev/null +++ b/protected/src/configs/on_view_mode.php @@ -0,0 +1,9 @@ + array('json', 'common', 'flexbox', 'default') +)); \ No newline at end of file diff --git a/protected/src/controllers/app/home_ctrl.php b/protected/src/controllers/app/home_ctrl.php new file mode 100644 index 0000000..2209269 --- /dev/null +++ b/protected/src/controllers/app/home_ctrl.php @@ -0,0 +1,50 @@ + + * @copyright (c) 2025, Robert Strutts + * @license MIT + */ +namespace Project\controllers\app; + +/** + * Description of home_ctrl + * + * @author Robert Strutts + */ +class home_ctrl { + + public function index() { + $html = new \CodeHydrater\html_document(); + $html->set_author("Robert Strutts, plus ME!"); + + $view = new \CodeHydrater\view(); + $view->set('html', $html); + $view->set_template('main'); + $view->include("app/header"); + $view->include("app/footer"); + $view->render($this, "app/home_index"); + } + + public function name_demo() { + echo "OLD DEMO Page...!"; + } + + /** + * from Routes + * + */ + public function test(int $id) { + echo "The ID for Test Example is # $id"; + } + + public function demo(?string $name="Test", ?int $limit=10, ?int $page=1) { + echo "DEMO Name: ". $name; + echo "LIMIT = ". $limit; + echo "PAGE = ". $page; + } + + public function error() { \CodeHydrater\bootstrap\broken_error(); } // Needed: To show Live Page for Broken Pages must only be in the default Project HomePage +} diff --git a/protected/src/routes/routes.php b/protected/src/routes/routes.php new file mode 100644 index 0000000..a0c62ff --- /dev/null +++ b/protected/src/routes/routes.php @@ -0,0 +1,17 @@ + + + + + + + + + + + + + <?= $html->get_title(); ?> + + + + + + + + get_head(); ?> + get_main_styles(); ?> + get_styles(); ?> + get_main_scripts(); ?> + + get_body(); ?>> + + page_output ?> + + get_footer(); ?> + + get_scripts(); ?> + get_js_onready(); ?> + + \ No newline at end of file diff --git a/protected/src/views/default/app/footer.php b/protected/src/views/default/app/footer.php new file mode 100644 index 0000000..c2975d3 --- /dev/null +++ b/protected/src/views/default/app/footer.php @@ -0,0 +1,18 @@ + [], +]; + +//const JS_TSR = [ "js/trouble_shooting_routes.js" =>[] ]; + +//const JS_FILES = [ +// "js/routes.js" => [], +//]; + +$html->set_assets_from_array(JS_CDN_FILES, 'main_js', 'cdn'); +//$html->set_assets_from_array(JS_TSR, 'js', 'assets'); +//$html->set_assets_from_array(JS_FILES, 'js', 'project'); \ No newline at end of file diff --git a/protected/src/views/default/app/header.php b/protected/src/views/default/app/header.php new file mode 100644 index 0000000..8fa396b --- /dev/null +++ b/protected/src/views/default/app/header.php @@ -0,0 +1,14 @@ + ['media'=>'all'] +]; + +const CSS_FILES = [ + 'css/main.css' => [], +]; + +$html->set_assets_from_array(CSS_CDN_FILES, 'main_css', 'cdn'); +//$html->set_assets_from_array(CSS_FILES, 'css'); diff --git a/protected/src/views/default/app/home_index.php b/protected/src/views/default/app/home_index.php new file mode 100644 index 0000000..eae20cb --- /dev/null +++ b/protected/src/views/default/app/home_index.php @@ -0,0 +1,11 @@ + + +

Welcome...to your M0ck Ups

+ +View Name Demo

\ No newline at end of file diff --git a/public/index.php b/public/index.php index b009ea9..daf9f91 100644 --- a/public/index.php +++ b/public/index.php @@ -15,6 +15,6 @@ const CodeHydrater_FRAMEWORK = BaseDir . "/protected/FWCodeHydrater/src/"; $testing = false; require_once CodeHydrater_FRAMEWORK . 'bootstrap/site_helper.php'; -CodeHydrater\bootstrap\site_helper::init(BaseDir, $_SERVER['REQUEST_URI'], $_SERVER['REQUEST_METHOD'], $testing); +CodeHydrater\bootstrap\site_helper::init(CodeHydrater_PROJECT, $_SERVER['REQUEST_URI'], $_SERVER['REQUEST_METHOD'], $testing); require_once CodeHydrater_FRAMEWORK . "bootstrap/main.php"; \ No newline at end of file