User1264 User1264 - 1 year ago 41
HTML Question

How would I get links from another file?

Instead of copying and pasting this same code into multiple pages I want to make a html file and then paste the code there and link all the pages to that one file to get the links. Is this possible??

Example of code

my code is

<a href="WebPage1.html"><img src="button1.png" onmouseover="this.src='buttonA.png'" onmouseout="this.src='button1.png'"></a>

<a href="WebPage2.html"><img src="button2.png" onmouseover="this.src='buttonB.png'" onmouseout="this.src='button2.png'"></a>

<a href="WebPage3.html"><img src="button3.png" onmouseover="this.src='buttonC.png'" onmouseout="this.src='button3.png'"></a>

What I'm trying to get

<link rel="WebNavigation.html"> ?

Something along those lines, I'm trying to use one line of code instead of 3

Answer Source

<?php include("your file location"); ?> This should do the work using php.


<div class="web-nav">
  <?php include("WebNavigation.html"); ?>

You need some knowledge in php programming if you want to achieve your desired result.