Alternative php include for handlebars.js in building templates

Asked

Viewed 156 times

3

I am 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 good practices. I believe that creating a:

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

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

  • 1

    Either there are many possible answers or good answers would be too long for this format. Add details to reduce the set of answers or isolate a question that can be answered in a few paragraphs.

1 answer

1


I’m still waiting for more ideas but the best solution I could find for now 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, giving include no body. I’m finding a good alternative for now! Only problem is keeping all templates in the same html file.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.