You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
69 lines
1.9 KiB
69 lines
1.9 KiB
<?php
|
|
|
|
declare(strict_types = 1);
|
|
|
|
/**
|
|
* @author Robert Strutts <Bob_586@Yahoo.com>
|
|
* @copyright (c) 2025, Robert Strutts
|
|
* @license MIT
|
|
*/
|
|
namespace Project\controllers\app;
|
|
|
|
use CodeHydrater\enums\view_type as ViewType;
|
|
|
|
/**
|
|
* Description of home_ctrl URL Route: /FOLDER/FILE/METHOD
|
|
* /app/home/name_demo
|
|
*/
|
|
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", ViewType::PHP);
|
|
$view->include("app/footer", ViewType::PHP);
|
|
$view->render($this, "app/home_index", ViewType::PHP);
|
|
}
|
|
|
|
public function name_demo() {
|
|
$view = new \CodeHydrater\view();
|
|
$view->set('twig_data', ['name' => "John Doe"]);
|
|
$view->render($this, "app/test", ViewType::TWIG);
|
|
}
|
|
|
|
public function liquid() {
|
|
$view = new \CodeHydrater\view();
|
|
$view->set('template_assigns', [
|
|
'name' => "James Smith",
|
|
'date' => date('Y-m-d')
|
|
]);
|
|
$view->render($this, "app/liquid", ViewType::LIQUID);
|
|
}
|
|
|
|
public function extra() {
|
|
$loaded = \CodeHydrater\extras_booter::tryToEnableFeature("testing", refresh: true);
|
|
if ($loaded === false) {
|
|
echo "Unable to load Feature...";
|
|
}
|
|
}
|
|
|
|
/**
|
|
* 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: ". \CodeHydrater\bootstrap\safer_io::p($name);
|
|
echo "LIMIT = ". $limit;
|
|
echo "PAGE = ". $page;
|
|
}
|
|
|
|
public function error_demo() { \CodeHydrater\bootstrap\broken_error(); }
|
|
}
|
|
|