I wonder how different people handles different "file structures" for templates.
I know that you can only put php code inside a template files, and i have thought that when you have to create a lot of unique "pages" with different php code it will take time to create a template file for each page.
Not only that, but eventually, if you create a lot of templates, the templates folder would get very crowded. I was looking for a better way to organize my php files and found this solution. Instead of creating a template for each unique page with custom php code, I just create a single template named "include". This template just has two fields: title and include_path.
The code of this template is just: <?php include $page->include_path; ?>
In the "include_path" field I set the relative path for including other php files, and this method gives me a more organized collection of php files nested in various folders.
For example, for a form called "reservation", I would just create a page with the template "include", and the field "include_path" set to "./php/forms/reservation.php".
An example of this file structure:
site/
--templates/
-----/styles
-----/scripts
-----/php
--------/forms
--------/processes
--------/catalogs
--------/galleries
-----head.inc
-----foot.inc
-----home.php
-----blog-post.php
-----include.php
Do anyone know if there is a better way to handle php files? o anybody would share their file structure approach?