mg_
mg_

Reputation: 160

Javascript template or another solution?

New to webdev.

I need to use the same menu on all the pages of new website i'm building but I'm not willing to edit the menu every time a change it in every file.

Is there a simple template engine for javascript or another solution to fix this issue?

Upvotes: 0

Views: 136

Answers (1)

James
James

Reputation: 5169

If the menu is dynamically constructed via your website, then you're best bet is to use server-side templates.

In PHP you can do:

include("menu.php");

Wherever you need it to display.

In JavaScript, if you need to style the menu, then check out Mustache.JS or similar.

Upvotes: 3

Related Questions