Hello all,

I searched the forum and found out how to implement a Flash header into my FriendsForever theme. It's pretty simple, I just edited the page.tpl.php file and put it in the header div.

My problem is that this affects every page in Drupal. I only want the Flash header to show on the home page, like node/1. For the rest of the nodes I want to use a normal JPG image.

Any suggestions would be great!

Comments

vm’s picture

There are multiple ways to go about this however, one way is create a page-front.tpl.php file
now open page.tpl.php and copy the entire contents into your page-front.tpl.php. remove the flash from page.tpl.php and save. Then save and uploade page-front.tpl.php

another method would be inserting some php into the template file. something simiar to

if page=front then do this else do this. Though I can't find that snippet at moment and can't recall teh exact syntax but I know its in the handbook area.

JonMB’s picture

Does Drupal automatically know that "page-front.tpl.php" is for the front page only?

vm’s picture

yes

JonMB’s picture

Yes, indeed it does. I just confirmed this myself.

Wow, that was much easier than I expected. Thanks so much! :D

sicbot’s picture

Why go that far?

I just added a block to the top of the page. tell it only to show on the home page and add a flash object.

<object type="application/x-shockwave-flash" data="flash/home.swf" width="926" height="218" id="flash"> 
<param name="movie" value="flash/home.swf" />
</object>

Just seems like your doing it the hard way o.0

JonMB’s picture

Thanks for your recommendation. I tried using a block at first but it didn't seem to show correctly. I have modified the FriendsForever template quite a bit, and that's probably why.

Using page-front.tpl.php was the perfect solution in my case.

solona’s picture

I got this to work, but the flash header disappears as soon as I'm too deep into the site. It works on the front page, on the administer page, and on the "about" page. Everything else, it disappears. Any ideas why? Thanks a bunch!

vm’s picture

There are two methods mentioned in this thread. Care to point out which method you used?

solona’s picture

Oh, oops. I put the flash code into the header div tag in page.tpl.php.