开发者

PHP Includes - don't reload template

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 &amp; 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.


you can put your information on iframe so when you click the link, you just reload the content inside the iframe. actually this is not the best way, but you can try it. for example:

<div id="top">put your header menu or animation here</div>
<div id="content">
  put your content here inside an iframe
  <iframe name="iframe_content" src="home.php"></iframe>
</div>
<div id="footer">put your footer here</footer>

then just make link like:

<a href="Home.php" target="iframe_content">Home</a>
<a href="company.php" target="iframe_content">Company</a>
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜