-
Notifications
You must be signed in to change notification settings - Fork 0
Creating website pages
Ricky edited this page Feb 21, 2022
·
3 revisions
The website referred to in this documentation sits on top of HamletCMS, you cannot create content for it directly through the CMS (without writing code to pull the content through). HamletCMS comes with a boilerplate site module within the core codebase /app/modules/core/Website
. This should be overridden with your own using an addon module as follows:
- Copy the module in /app/modules/core/Website into /app/modules/addon/MyWebsite
- Correct the namespace in /app/modules/addon/MyWebsite/controller/Site.php
- Update config/config.json file, under environment set
"site_controller": "\\HamletCMS\\MyWebsite\\controller\\Site"
- Update the home function in Site.php as required
- Add a public function to your Site controller
- Name the function the same as the url path - so for an about page (example.com/about) the function should be called 'about'
- Note: the terms 'blogs', 'cms' and 'api' are already used so don't use them!
- Call
$this->response->write('<template-path>', 'MyWebsite');
to output a smarty file (see full response documentation) - Create the smarty template file under
/app/modules/addon/MyWebsite/templates
- Note: by default semantic UI is included
Using this site controller gives you chance to use the HamletCMS model to query blog data and display on the website as you feel fit as well as providing a simple routing system for clean URLs.