|
|
|
|
|
by roosgit
2387 days ago
|
|
In a somewhat similar situation I used PHP with `include`. The structure was something like this: - index.php
- header.php
- sidebar.php
- footer.php
- page-1.php
- page-2.php
...
In `header.php` I used variables for the title, description, etc. and then in each page I specified the values for those variables. This way each page had the same header HTML code, but with a different title, description and so on. |
|
All my HTML is held in template .html files, with %%PLACEHOLDER%% text where the dynamic content should be, Then my index.php is the main 'app' loading in the templates to build the output, doing string replaces on the html, and then a single final 'echo' to send the result to the user at the end of the process.
I think this is called 'code behind' - I've just always had a problem with mixing code and layout in the same file.
Does anyone else do it like this?