admin
Cms
2023/06/22
5.0

You can follow these steps to add a static page to your site. "static_page" name will be used as an example, but you can change this name as you want.

1. Open "app/Controllers/HomeController.php" file and add your function:


public function staticPage()
{
$data['title'] = "This is a static page";
$data['description'] = "This is a static page";
$data['keywords'] = "static,page";

echo view('partials/_header', $data);
echo view('static_page', $data);
echo view('partials/_footer');
}


2. Create a "static_page.php" file in the "app/Views" folder. You need to add your HTML and CSS codes to this file.

3. Open the "app/Config/Routes.php" file to create a route for your page. You can add the following line just after "$routes->get('/', 'HomeController::index');" line in this file:

$routes->get('/static-page', 'HomeController::staticPage');

After these edits, you can access this page with "domain.com/static-page" URL.