Getting started

MaplePHP comes out of the box with both a back- and frontend template engine that communicates seamlessly. Instead of grappling with the complexities of new markup and platform-specific functions, which in the end only lead to the burden of unnecessary abstractions, MaplePHP harnesses PHP's and JavaScript's core capabilities. It promotes a practical and fundamental approach to modern development.

You can, of course, change the engine to one you feel comfortable with. Also, feel free to ask me if you want a guide on installing a different engine.

File overview

You find all template files in the resources/ directory for the application.


The index file

You could also have multiple index files, even though you most likely very rarely need to change them. It's a good option if you want to have completely different index files, for example, a public index file and a private index file.

The view directory

You can only have one view at a time. Managing with about two views is usually sufficient—one for holding your main partial content and another for 404 pages. However, I also like to use views to switch between completely different layouts and subjects, such as having one main view for regular pages and another for blog pages with a sidebar partial (for search and categories) and a post content partial.

The partials directory

You will place all your template partial files in the "partials" directory. These are very effective for extending your template view file with content like sections, posts, sidebars, and so on. You can load the same partial multiple times directly from your controller and place them in different sections in your document.

The js directory

This is where all your "own" and the main.js development JavaScript files exist. The main.js file has a boilerplate code integrated with Startox.js that makes it possible for the backend to communicate seamlessly with the frontend.

The lang director

You will place all your language/static translation files in the "lang" directory. It comes with two files already: "auth.php," which is used for the installable login form, and "validate.php," which is used for the built-in validation and form builder. You can read more about the form builder under the Form Builder section.

Let´s start utilizing the PHP template engine.

Last updated