Hello. I'm doing a website with drupal 6. i'm using millex theme, a commercial theme which has a beautiful flash slideshow (.swf), but unfortunately the slide appears on all pages. Does anyone know give me directions on how to make it appear only on the frontpage? Thanks a lot for your help.

Comments

ayesh’s picture

Did you checked if the flash animation is in a block ?
Admin > Build > Block page ?
If yes, you can add page-specific visibility rules to the block.

If SWF is not there, and Panels module is not used, most likely that it's embeded in page.tpl.php file.

riccardogalli’s picture

no is not a block, in fact is in page.tpl.php
How can i make visible only in the homepage?

thanks a lot you save my life :)

              <div class="head-row3">
                	<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"
                        codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,24"
                        width="100%" height="412">
                        <param name="movie" value="<?php print base_path().path_to_theme() ?>/flash/header_v8.swf?xmlUrl=<?php print base_path().path_to_theme() ?>/flash/xml/tfile_main.xml" />
                        <param name="quality" value="high" />
                        <param name="menu" value="false" />
                        <!--[if !IE]> <-->
                  		<object data="<?php print base_path().path_to_theme() ?>/flash/header_v8.swf?xmlUrl=<?php print base_path().path_to_theme() ?>/flash/xml/tfile_main.xml"
                            width="100%" height="412" type="application/x-shockwave-flash">
                            <param name="quality" value="high" />
                            <param name="menu" value="false" />
                            <param name="pluginurl" value="http://www.macromedia.com/go/getflashplayer" />
                            FAIL (the browser should render some flash content, not this).
                        </object>
                        <!--> <![endif]-->
ayesh’s picture

1. Set admin theme to Garland.
2. Copy page.tpl.php to front.tpl.php
3. Remove the above code from page.tpl.php

//page.tpl.php is the general template for pages, and page-front.tpl.php will be used only in front page.
But most likely that this will screw up your site's layout. So if you got any error, you can undone it and access admin pages from /admin page. these pages will use Garland theme.

riccardogalli’s picture

ok, I will use the method you have indicated, the problem is that I have not the page called front.tpl.php. In the theme folder there: box, block, comment, node, page, template. Tpl.php and nothing more. How can I do?
I tried to create a new front.tpl.php page and do that you have recommended, but not working.

ayesh’s picture

Create a new page-front.tpl.php and copy contents of page.tpl.php to it. Sorry for not being too specific.

riccardogalli’s picture

I already did. the result is that the flash slideshow is no longer seen around the site, even on the homepage

d_l’s picture

This might help .. instead of embedding swf in place of logo (as in the thread below) put the block in

http://drupal.org/node/1043550

Another way .. perhaps easier to test .. is to create a block with an iframe pointing to the swf file (running somewhere on your host or an external host).

riccardogalli’s picture

the problems are: this slideshow is not place in logo area, and there is no areas in block section which to put a block with the slide inside.

d_l’s picture

This double post was in error (I was trying to correct a typo).

d_l’s picture

As I explained you don't need to place the swfobject in logo container .. that was an example .. the principles apply for any container.

Here is the Iframe approach .. I'll post the other solution later ..

Go to Administration > Configuration > Content Authoring > text formats

Add text format

Name: Adminonly iframe
Roles: administrator only (for security)
Enabled filters: tick "Limit allowed HTML tags"
In "Allowed HTML Tags" field > add .. < iframe >
Save configuration

================================

download swfobject_2.2 and place in a convenient location on your server

http://code.google.com/p/swfobject/

e.g. http://localhost:8080/swfobject

or you might put it in /sites/all/files/swfobject

================================

go to Administration > Structure > Blocks

add block

create newly created text format > Adminonly Iframe
Block description > embed swfobject
Block title > leave empty
Block body

<iframe name="swfobject" src="http://localhost:8080/swfobject/index_dynamic.html" width="300" height = "140" frameborder="0" scrolling="no" >
Your browser needs to have iframes enabled to view this dynamic content.</iframe>

Region Settings

choose where you want the swfobject to be embedded.

e.g. I have Marinelli (default theme) in Content region

Optionally you can use the field "Show block on specific pages" (e.g. <front>)

Save block

schnelle02’s picture

I think you should be able to create a new block, with the input method of PHP code. Then simply paste this code into the block:

<div class="head-row3">
                <object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"
                        codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,24"
                        width="100%" height="412">
                        <param name="movie" value="<?php print base_path().path_to_theme() ?>/flash/header_v8.swf?xmlUrl=<?php print base_path().path_to_theme() ?>/flash/xml/tfile_main.xml" />
                        <param name="quality" value="high" />
                        <param name="menu" value="false" />
                        <!--[if !IE]> <-->
                  <object data="<?php print base_path().path_to_theme() ?>/flash/header_v8.swf?xmlUrl=<?php print base_path().path_to_theme() ?>/flash/xml/tfile_main.xml"
                            width="100%" height="412" type="application/x-shockwave-flash">
                            <param name="quality" value="high" />
                            <param name="menu" value="false" />
                            <param name="pluginurl" value="http://www.macromedia.com/go/getflashplayer" />
                            FAIL (the browser should render some flash content, not this).
                        </object>

Now you can add the block to a section of the page through the interface and specify that it will appear only on the homepage in the block configuration. You may also need to add styles to get it to appear on the page exactly where you want. You can do that by wrapping the block in:

<div class="mynewclass">
rest of code here
</div>

You can now set the css for the class in your stylesheets to move the slideshow to the header.
You would also need to remove the code from page.tpl.php to keep it off all the other pages.

ayesh’s picture

And consider using relative paths to save some microseconds of load time.

riccardogalli’s picture

First thanks to all, is my first post and as you know I am a beginner and not a programmer. I'm still willing to throw myself into this thing by following your instructions. Just one question: This block, created with the code that runs inside the slide, go through the interface located in a region of the site as all the blocks. But in the block's page there isn't the correct region where to place it. In that zone of the site I see just sidebars and content area. Nothing showcases area, main area of ​​the top, nothing..

riccardogalli’s picture

I followed your instructions and created the block with the slide inside. I do not know how to put it in the right position, the space under the head.

"You can now Set The css for the class in your stylesheets to move the slideshow to the header.
Also you need to remove Would the code from page.tpl.php to keep it off all the other pages. "

This is the part that I miss. Can you help me?

schnelle02’s picture

You can put it in one of the sections that isn't being used and it probably won't start in the exact position you want it in. But by editing the Stylesheets, you have the power to move it around the page. say you put it in a section called "over-content" but it is appearing too low on the page. You can fix this by wrapping the entire block in a class according to how I said. Something like this:

<div class="mynewclass">
rest of slideshow code in the block
</div>

Then open a css stylesheet '/sites/all/themes/CURRENT_THEME/css/styles.css'. Add this to the bottom of the text file.

.mynewclass{
margin-top:-100px;
}

Then save the file and reload your page. You can see the slideshow move up on the page this way and position it where you want manually. Also, if you download firebug it will help in this process. Good luck!