Problem: I would like to insert 3 image banner/ads in the header of my website (which will show up the same on every page). But about once a month, I’ll need to change the promotions for each of the 3 ads (and of course, the same changes will be made for every page).
Each banner/ad will simply point to a different web page.
Is there a way to set this up so that when I make changes to the code, the effect will take place on every page on my website?
I don’t want to open each web page, and have to edit the code on every single page. It will take too long…
With PHP you can use an include file. The file can be included in multiple web pages. Simily edit the one file and the changes will appear on all pages that include it. You’ll have to learn a little PHP and host your site on a server that supports PHP. There may be other solutions, but this is the one I’d use.
<html>
<body>
<?php include(“header.php”); ?>
<h1>Welcome to my home page!</h1>
<p>Some text.</p>
You could even get the included file to change automatically depending on the date:
$day = date('d');
switch($day;)
{
case 1:
case 2:
case 3:
case 4:
case 5:
case 6:
case 7:
case 8:
case 9:
case 10:
case 11:
case 12: include('first_12_days.php');
break;
case 13:
case 14:
case 15:
case 16:
case 17:
case 18:
case 19: include('teen_days.php');
break;
default: include('last_days.php');
}