Alternative php include for handlebars.js when building templates

Question:

I'm making a new website, I have the template ready and I want to implement handlebars.js,

To control the template I always used:

<php include "header.php"; ?>
<php include "footer.php"; ?>

and etc.

I want to improve the level of my projects using handlebars.js but I don't know how to control the template with best practices. I believe that creating a:

<script id="header" type="text/x-handlebars-template"></script>

and putting my entire header in there with all the tags and css calls would not be a good practice. What would be the best alternative for includes?

Answer:

I'm still waiting for more ideas but the best solution I found so far was to use Ember.js and its template structure. http://emberjs.com/guides/templates/the-application-template/

Making a template with all the header, footer and etc, including the body. I'm finding a good alternative for now! The only problem is keeping all templates in the same html file.

Scroll to Top