...

View Full Version : Simple flash banner



pcupgradeltd
10-26-2006, 12:35 PM
Hi

Total nub to HTML/CSS altho i have nmanaged to upload and configure my on-line shop and make a few amendments from simple mods with easy instructions.

All I want to do is add 1 flash banner (.swf file) to the space in the topheader. I have read various posts/articles on doing this but tbh am still confused.

The file I have will work in ie if I right-click and select open with ie it works! But I dont know how to add it to the correct section or page let alone code it if it needs coding?

I want to add the file to the white space between the logo and the search/login box.

homepage http://www.pcupgradeltd.co.uk

Any help would be appreciated thanks

harbingerOTV
10-26-2006, 01:54 PM
first read this page. http://blog.deconcept.com/swfobject/

then putting it in woudl be something like:



<div id="topHeader">
<div id="sessionBox">
<div style="padding: 15px 8px 15px 15px; margin: 0px;">

<form action="index.php" method="get" style="padding: 0px; margin: 0px;">
<span class="txtSession"><strong>Search for:</strong></span><br /><input name="searchStr" type="text" class="searchBox" id="searchStr" value="" size="22" />
<input type="hidden" name="act" value="viewCat" />
<input name="Submit" type="submit" class="searchBtn" value="Go" />
</form>


<div style="padding-top: 2px;">

<span class="txtSessionGrey">Welcome Guest</span>
<br />
<span class="txtSession">[</span><a href="index.php?act=login&amp;redir=L2luZGV4LnBocA==" class="txtSession">Login</a> <span class="txtSession">|</span> <a href="cart.php?act=reg&amp;redir=L2luZGV4LnBocA==" class="txtSession">Register</a><span class="txtSession">]</span>



</div>

</div>
</div>

<div id="flashcontent" style="float:right;width:200px;height:100px;">
This text is replaced by the Flash movie.
</div>

<script type="text/javascript">
var so = new SWFObject("movie.swf", "mymovie", "200", "100", "7", "#336699");
so.write("flashcontent");
</script>

</div>


of course changing the SWF name and the sizes to suit.

if you float it like that it just needs to go after the div id="sessionBox" ends but before the div id="topHeader" does.

pcupgradeltd
10-26-2006, 03:15 PM
Thanks for the reply but im still not sure where to put (is it just the red bits)the code, is it index.php? as mine has loads of includes down the page and I cant see any header details resembling your example :-s

Sorry but did read the link too and none the wiser. I have uploaded the .swf file into a skins\backgrounds\images directory and have added the line into here;

<div id="flashcontent" style="float:right;width:200px;height:100px;">
This text is replaced by the Flash movie.
</div>

<script type="text/javascript">
var so = new SWFObject("../styleImages/backgrounds/468x60_generic.swf", "mymovie", "200", "100", "7", "#336699");
so.write("flashcontent");
</script>

but thats as far as ive got!

harbingerOTV
10-26-2006, 05:44 PM
well if your site in using a lot of includes, youre going to need to find the include that is the header (ie. has the #topHeader div in it). I cant see the files seperatly so that parts up up to you.

Once in there, yep, include the red parts. You need to get the javascript as well in order for the flash object to work. Put the javascript in the include (assuming it's a include file) that has all your other javascripts in it. ex:


<link href="skins/Killer/styleSheets/layout.css" rel="stylesheet" type="text/css" />
<link href="skins/Killer/styleSheets/style.css" rel="stylesheet" type="text/css" />
<script language="javascript" src="js/jslibrary.js" type="text/javascript"></script>
<script language="javascript" src="js/swfobject.js" type="text/javascript"></script>
</head>


then on the swf itself do something like:



<div id="flashcontent" style="float:right;width:468px;height:60px;"></div>
<script type="text/javascript">
var so = new SWFObject("../styleImages/backgrounds/468x60_generic.swf", "mymovie", "468", "60", "7", "#ffffff");
so.write("flashcontent");
</script>


Im guessing 468x60 are the dimensions of your swf file. If it isnt, just change th esizes in both the div and the script.

pcupgradeltd
10-27-2006, 10:42 AM
Right, added the code;

<link href="skins/Killer/styleSheets/layout.css" rel="stylesheet" type="text/css" />
<link href="skins/Killer/styleSheets/style.css" rel="stylesheet" type="text/css" />
<script language="javascript" src="js/jslibrary.js" type="text/javascript"></script>
<script language="javascript" src="js/swfobject.js" type="text/javascript"></script>
</head>

To index.php (should the paths be complete in the lines link href="skins/Killer/styleSheets/style.css" rel="stylesheet" ? ie ../skins etc

Also added the code;

<div id="flashcontent" style="float:right;width:200px;height:100px;">
This text is replaced by the Flash movie.
</div>

<script type="text/javascript">
var so = new SWFObject("../styleImages/backgrounds/468x60_generic.swf", "mymovie", "468", "60", "7",

"#336699");
so.write("flashcontent");
</script>

Into index.tpl file wher the topHeader Div was but its not working as you can see, just get the Text 'THis text is replaced by the flash movie' ?

pcupgradeltd
10-27-2006, 03:58 PM
OK got it working at last :-)

Needed to download the swfObject.js file an upload it to the JS folder.

Also the code in the post above
<link href="skins/Killer/styleSheets/layout.css" rel="stylesheet" type="text/css" />
<link href="skins/Killer/styleSheets/style.css" rel="stylesheet" type="text/css" />
<script language="javascript" src="js/jslibrary.js" type="text/javascript"></script>
<script language="javascript" src="js/swfobject.js" type="text/javascript"></script>
</head>

wasn't required as it was already in the index.tpl file where adding the .swf code.

Just 1 thing now is how to centre it in the header?



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum