Variable content again

php4ever 0 Tallied Votes 86 Views Share

While doing a redesign of two sites I had this need to take my clients TemplateMonster template and show flash on ONLY the front page and a static image on the internal pages but the problem was that it ran on a template engine which used a single load header type setup not to different from a wordpress template. That being said, I simply added some php to show only the flash file on the home page.

Now this DOES work for WordPress, Open-Realty, vBulletin and many other theme engines I've designed for over the years.

Here is the basic idea.
If the home page, show the flash, if not show something else.

Enjoy!

File: flash-slideshow.php would include the flash code as well as the JS link to the swfobject fix for flash and IE.

File: banner-ad.php would include the html code and random advertising rotator based on javascript in this case.

######### Plug this into your header.php file
<?php
$P=$_SERVER['REQUEST_URI'];
if ("$P" == "/index.html" || $P == "/" || "$P" == "/index.php")
{
        include('flash-slideshow.php');
} else {
        include('banner-ad.php');
}
?>

######### create your two alternative content code items you wish to load.