Repeat HTML code in multiple pages (js/angular)
The "site" contains fixed stuff, like a complex navigation bar, that is composed by lot of lines of code, that got repeated in each page.
I'd obviously like to avoid code repetitions, both for ease of change (if i'd like to change a voice in my navbar i should change it in all the pages, argh!), so i was thinking to use something to memorize my code and repeat it while loading the page.
I don't really know how to do it, i should declare a function that, if called, loads my snippet but i really don't know how this should be handled!
Thank you very much
Ok, so i'm really into php..
Originally Posted by iBeZi
i could invoke this script inside my html page?
it would grant full compatibility with every device?
By the way, my html page is something like:
<?php include('mypage.html'); ?>
with mypage.html in the same folder, but it doesn't seem to work..
PHP scripts will only work if the page they're on has the PHP extension, such as "index.php" and are being run on a server which supports PHP.
You can install a local PHP server for testing PHP websites using xampp
Users Browsing this Thread
There are currently 1 users browsing this thread. (0 members and 1 guests)