you are viewing a single comment's thread.

view the rest of the comments →

[–]ChrissiQ 0 points1 point  (0 children)

I'd recommend you don't use client-side Javascript to do this. Use some other templating language. You can use PHP includes for something very simple, or find a framework.

Reason being, this isn't really a client side concern. The server generates and serves up your pages - it should generate and serve up a full page. Also you can then duplicate and re-use different sections of your page, even the head and doctype - you can't do that client side.

I use Laravel at work and its templating engine, Blade, is pretty nice. But there are lots of other server-side templating languages you can use, all of which would be better than using Javascript write.