I'm currently revamping this site: www.epeinternational.com in PHP.
I have it set up so the content of each page is included depending on the users menu choice:
In the head:
$page = $_GET['page'];
Menu:
<a href="index.php?page=Home">Home</a>
<a href="index.php?page=Company">Company</a>
<a href="index.php?page=Company Financials">Company Financials</a>
<a href="index.php?page=News and Rewards&year=2011">News & Rewards</a>
<a href="index.php?page=Products">Products</a>
<a href="index.php?page=Promotions">Promotions <i style="color:red">(NEW)</i></a>
<a href="index.php?page=Brochures">Our Brochures</a>
<a href="index.php?page=Master Cook Shop Gallery">Master Cook Shop Gallery</a>
<a href="index.php?page=Contact Us">Contact Us</a>
In Content space:
<?php
if (!isset($page)) {
include('home.php');
}
if ($page == "Home") {
include('home.php');
}
if ($page == "Company") {
include('company.php');
}
if ($page == "Company Financials") {
include('companyfinancials.php');
}
if ($page == "News and Rewards") {
include('newsandrewards.php');
}
if ($page == "Products") {
include('products.php');
}
if ($page == "Promotions") {
include('promotions.php');
}
if ($page == "Brochures") {
include('brochures.php');
}
if ($page == "Master Cook Shop Gallery") {
include('mcsgallery.php');
}
if ($page == "Contact Us") {
include('contactus.php');
}
if ($page == "Credit Account Form") {
include('creditform.php');
}
?>
All of this works fine, however, as you can see on the website, there's a flash movie on every page. I want to make it so this flash movie doesn't get reloaded every time the user changes page. I thought what I had would do the trick, but apparently not. I also tried removing the 'index.php' from the menu links, leaving only ?page= , but this returned the same result. Can someone point me in the right direction please.
The Flash movie will play on every page load, and when you click one of those links the page reloads.
You'd need to edit the Flash to accept a flashvar
, that will tell the flash movie what state it should be in: "first page load" or "any other page load".
If you can't modify the flash, an alternative would be to use a static image/another flash on consecutive page loads.
To know if this is the first page load, I'd recommend using PHP sessions.