News:

Wondering if this will always be free?  See why free is better.

Main Menu

Flash banner

Started by Pinball Nation, January 12, 2012, 08:10:14 PM

Previous topic - Next topic

Pinball Nation

How do i add a swf banner to the header of my forum?I am using smf 2.2.Thanks.

Chas Large

Where exactly do you want to place it? What theme are you using?
My Modifications :)  My Forum

Please DO NOT PM me with support requests. Post the problem in the appropriate Support Board so everyone can benefit from the advice given.

Pinball Nation

I am using the smf core theme.I would like to add it to the top where the simple machines logo is.

TheListener

The smf logo can only be removed if you place a motto there AFAIK.

Admin >> Configuration >> Theme Settings >>
Quote
Logo image URL:
(leave blank to show forum name or default logo.)

Image Link goes here


QuoteSite slogan:
Add your own text for a slogan here. It will replace the SMF logo.

Motto goes here

Texan78

Quote from: Old Fossil on January 13, 2012, 04:03:03 PM
The smf logo can only be removed if you place a motto there AFAIK.

Admin >> Configuration >> Theme Settings >>
Quote
Logo image URL:
(leave blank to show forum name or default logo.)

Image Link goes here


QuoteSite slogan:
Add your own text for a slogan here. It will replace the SMF logo.

Motto goes here

I am curious about this as well so I am glad I found this. With the above mentioned suggestion I know it's good for just logos but what about flash? Do you just put the path to the swf file like you would a normal image file? Do you not have to embed some code within one of the template files?

-Thanks

Pinball Nation

Thanks for the info Old Fossil.I already know how to do that.I have had the flash banners for smf before in the header in different versions.That's the problem.The code changes from version to version.You have to know where in the index template to place it.I have also learned that the code for the flash banner may have to be tweeked also to get it to work correct. That's why i have to ask the same question everytime i upgrade.

Chas Large

Yes, what Old Fossill has posted is correct for static images. For Animated SWF banners you need to edit some code, namedly the Themes/default/index.template.php file

Find:

echo !empty($settings['forum_width']) ? '
<div id="wrapper" style="width: ' . $settings['forum_width'] . '">' : '', '
<div id="header"><div class="frame">
<div id="top_section">
<h1 class="forumtitle">
<a href="', $scripturl, '">', empty($context['header_logo_url_html_safe']) ? $context['forum_name'] : '<img src="' . $context['header_logo_url_html_safe'] . '" alt="' . $context['forum_name'] . '" />', '</a>
</h1>';

// the upshrink image, right-floated


Edit the middle to comment out the line beginning <a href="', %scripturl.  etc and add after it the embed code for a SWF file like:

<OBJECT classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0" WIDTH="320" HEIGHT="240" id="yourfilename.swf" ALIGN="">
<PARAM NAME=movie VALUE="yourfilename.swf"> <PARAM NAME=quality VALUE=high> <PARAM NAME=bgcolor VALUE=#333399> <EMBED src="http://yourwebsite/yourforumname/Themes/default/images/Slide.swf" quality=high bgcolor=#333399 WIDTH="320" HEIGHT="240" NAME="yourfilename.swf" ALIGN="" TYPE="application/x-shockwave-flash" PLUGINSPAGE="http://www.macromedia.com/go/getflashplayer"></EMBED> </OBJECT>


So, assuming the yourfilename.swf file is in Themes/default/images you end up with:

echo !empty($settings['forum_width']) ? '
<div id="wrapper" style="width: ' . $settings['forum_width'] . '">' : '', '
<div id="header"><div class="frame">
<div id="top_section">
<h1 class="forumtitle">
<!-- <a href="', $scripturl, '">', empty($context['header_logo_url_html_safe']) ? $context['forum_name'] : '<img src="' . $context['header_logo_url_html_safe'] . '" alt="' . $context['forum_name'] . '" />', '</a> -->

<OBJECT classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0" WIDTH="320" HEIGHT="240" id="yourfilename.swf" ALIGN="">
<PARAM NAME=movie VALUE="yourfilename.swf"> <PARAM NAME=quality VALUE=high> <PARAM NAME=bgcolor VALUE=#333399> <EMBED src="http://yourwebsite/yourforumname/Themes/default/images/Slide.swf" quality=high bgcolor=#333399 WIDTH="320" HEIGHT="240" NAME="yourfilename.swf" ALIGN="" TYPE="application/x-shockwave-flash" PLUGINSPAGE="http://www.macromedia.com/go/getflashplayer"></EMBED> </OBJECT>

</h1>';

// the upshrink image, right-floated


This places the flash logo top left but if you want it centred, you can use a div statement to center it.
My Modifications :)  My Forum

Please DO NOT PM me with support requests. Post the problem in the appropriate Support Board so everyone can benefit from the advice given.

Pinball Nation

Thanks for the help Chas,I would like my flash banner centered.Could you give me the div code to do that.Also by chance.Do you know what size i need to make my banner to strech all the way across the header?

Texan78

Quote from: Pinball Nation on January 13, 2012, 06:03:59 PM
Thanks for the help Chas,I would like my flash banner centered.Could you give me the div code to do that.Also by chance.Do you know what size i need to make my banner to strech all the way across the header?

Wrap the included code you added for the flash in a div tag something like.

<div class="flash"><OBJECT classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0" WIDTH="320" HEIGHT="240" id="yourfilename.swf" ALIGN="">
<PARAM NAME=movie VALUE="yourfilename.swf"> <PARAM NAME=quality VALUE=high> <PARAM NAME=bgcolor VALUE=#333399> <EMBED src="http://yourwebsite/yourforumname/Themes/default/images/Slide.swf" quality=high bgcolor=#333399 WIDTH="320" HEIGHT="240" NAME="yourfilename.swf" ALIGN="" TYPE="application/x-shockwave-flash" PLUGINSPAGE="http://www.macromedia.com/go/getflashplayer"></EMBED> </OBJECT></div>


Then in your index.css add something like

.flash { align:center; }

Just a example, you can modify the attributes to your liking.

Now that I think of it you may not need to add a new class or wrap it in a div tag. You could just modify the div class it is already embedded between if it is the only thing between the tags.

Hope that helps

Chas Large

Texan78 is correct, the way to go is to use CSS, the problem is { align:center; } won't work as the CSS for the top section is quite complex. If you've already placed the SWF and changed it's width and height, you'll see it already impacts on the other elements of the top section. Forum description and user info. This is the best I can come up with to centre the object and minimise impact on the other elements.

1. Open the theme's CSS. Theme/default/css/index.css

Find:
/* the main title, always stay at 45 pixels in height! */
h1.forumtitle
{
line-height: 45px;
font-size: 1.8em;
font-family: Geneva, verdana, sans-serif;
margin: 0;
padding: 0;
float: left;
}


2. Add to the bottom of this, width: 35%; so you end up with:

/* the main title, always stay at 45 pixels in height! */
h1.forumtitle
{
line-height: 45px;
font-size: 1.8em;
font-family: Geneva, verdana, sans-serif;
margin: 0;
padding: 0;
float: left;
        width: 35%;
}


3. Add after this class a new class

div.forumtitle2
{
padding: 0;
width:0%;
float: right;
}


4. Reopen the index.template.php and surround the object code with the div tag like this

<div class="forumtitle2"><OBJECT classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0" WIDTH="320" HEIGHT="240" id="yourfilename.swf" ALIGN="">
<PARAM NAME=movie VALUE="yourfilename.swf"> <PARAM NAME=quality VALUE=high> <PARAM NAME=bgcolor VALUE=#333399> <EMBED src="http://yourwebsite/yourforumname/Themes/default/images/Slide.swf" quality=high bgcolor=#333399 WIDTH="320" HEIGHT="240" NAME="yourfilename.swf" ALIGN="" TYPE="application/x-shockwave-flash" PLUGINSPAGE="http://www.macromedia.com/go/getflashplayer"></EMBED> </OBJECT></div>


If you need to, adjust the width: 35%; in forumtitle class to shift the object left or right. Increase the value to shift right, decrease to shift left.
My Modifications :)  My Forum

Please DO NOT PM me with support requests. Post the problem in the appropriate Support Board so everyone can benefit from the advice given.

Pinball Nation

Thanks Chas,This is the code i was using in 2.0 RC3 global $context, $settings, $options, $scripturl, $txt, $modSettings;

$width = 1230;
$height = 80;
$banner_url = 'http://www.pinballpost.host22.com/Themes/default/images/bannerrose.swf';
echo !empty($settings['forum_width']) ? '
<div id="wrapper" style="width: ' . $settings['forum_width'] . '">' : '', '
<div id="header"><div class="frame">
<div id="top_section">
<h1 class="forumtitle">';
echo '<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0" width="', $width, '" height="', $height, '" id="flashlogo">';
echo '<param name="movie" value="', $banner_url, '" /><param name="quality" value="high" /><param name="bgcolor" value="#ffffff" />'; echo '<embed src="', $banner_url, '" quality="high" bgcolor="#ffffff" width="', $width, '" height="', $height, '" name="flashbanner" align="" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer"></embed></object> </h1>';
This code worked perfect.Will this code work in the 2.2 ?If so where would i need to place it.Thanks

Chas Large

Dunno? where was it placed before? did you get this from a previous support topic? if so, can you provide a link so I can see where the previous author suggested it goes.
My Modifications :)  My Forum

Please DO NOT PM me with support requests. Post the problem in the appropriate Support Board so everyone can benefit from the advice given.


Texan78

Thanks Chas for that clarification. I wasn't sure if the align would work because as you stated the complexity of the header. This will help me too as I am adding one to but I want it to fill the entire div.

Pinball Nation

Texan 78 the code i listed above will do what you are looking to do.The entire header will be a banner.It will push the upshrink arrow under the banner.I just don't know if it will work with this version of 2.2.I am sure the code will have to be tweaked a little.I'm just waiting for someone who knows about this stuff.

Texan78

Quote from: Pinball Nation on January 14, 2012, 06:29:52 PM
Texan 78 the code i listed above will do what you are looking to do.The entire header will be a banner.It will push the upshrink arrow under the banner.I just don't know if it will work with this version of 2.2.I am sure the code will have to be tweaked a little.I'm just waiting for someone who knows about this stuff.

Thanks, right now I am just using a static image until I can get the flash banner finished and also sort the sizing out. Right now my static image doesn't resize different resolutions. So this will fill the entire header regardless of resolution? As you can see with my static image depending on your resolution it doesn't fill the entire header. So with the code for the flash you're saying it will correct?

http://www.weather-connection.com/index.php

-Thanks

Chas Large

Quote from: Pinball Nation on January 14, 2012, 10:16:57 AM
Thanks Chas,This is the code i was using in 2.0 RC3 global $context, $settings, $options, $scripturl, $txt, $modSettings;

$width = 1230;
$height = 80;
$banner_url = 'http://www.pinballpost.host22.com/Themes/default/images/bannerrose.swf';
echo !empty($settings['forum_width']) ? '
<div id="wrapper" style="width: ' . $settings['forum_width'] . '">' : '', '
<div id="header"><div class="frame">
<div id="top_section">
<h1 class="forumtitle">';
echo '<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0" width="', $width, '" height="', $height, '" id="flashlogo">';
echo '<param name="movie" value="', $banner_url, '" /><param name="quality" value="high" /><param name="bgcolor" value="#ffffff" />'; echo '<embed src="', $banner_url, '" quality="high" bgcolor="#ffffff" width="', $width, '" height="', $height, '" name="flashbanner" align="" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer"></embed></object> </h1>';
This code worked perfect.Will this code work in the 2.2 ?If so where would i need to place it.Thanks

OK, yes this code will work in 2.0.2. Not sure where you get 2.2 from though?

Just tested it on my test forum but the banner does not display as the URL seems to be changed or you've moved your site. Even placing just the banner URL in the address bar gave me a page offering the site for sale? Anyway.

In Themes/default/index.template.php (editing the file directly in a plain text editor, by downloading via FTP to your computer and back up to the site after is the preferred method).

Find:
global $context, $settings, $options, $scripturl, $txt, $modSettings;

echo !empty($settings['forum_width']) ? '
<div id="wrapper" style="width: ' . $settings['forum_width'] . '">' : '', '
<div id="header"><div class="frame">
<div id="top_section">
<h1 class="forumtitle">
<a href="', $scripturl, '">', empty($context['header_logo_url_html_safe']) ? $context['forum_name'] : '<img src="' . $context['header_logo_url_html_safe'] . '" alt="' . $context['forum_name'] . '" />', '</a>
</h1>';



Replace with:
global $context, $settings, $options, $scripturl, $txt, $modSettings;

$width = 1230;
$height = 80;
$banner_url = 'http://www.pinballpost.host22.com/Themes/default/images/bannerrose.swf';
echo !empty($settings['forum_width']) ? '
<div id="wrapper" style="width: ' . $settings['forum_width'] . '">' : '', '
<div id="header"><div class="frame">
<div id="top_section">
<h1 class="forumtitle">';
echo '<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0" width="', $width, '" height="', $height, '" id="flashlogo">';
echo '<param name="movie" value="', $banner_url, '" /><param name="quality" value="high" /><param name="bgcolor" value="#ffffff" />'; echo '<embed src="', $banner_url, '" quality="high" bgcolor="#ffffff" width="', $width, '" height="', $height, '" name="flashbanner" align="" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer"></embed></object> </h1>';


So change the $banner_url variable value to the correct location on your site and it will display right across the top of the page.
My Modifications :)  My Forum

Please DO NOT PM me with support requests. Post the problem in the appropriate Support Board so everyone can benefit from the advice given.

Texan78

Quote from: Chas Large on January 15, 2012, 04:15:36 AM
Just tested it on my test forum but the banner does not display as the URL seems to be changed or you've moved your site. Even placing just the banner URL in the address bar gave me a page offering the site for sale? Anyway.

Were you referring to me or Pinball? I am not having any problems with my site that I know of. I have actually taken a different approach so I am not using the flash header. That may change in the future so this post will come in handy.

-Thanks

Chas Large

Quote from: Texan78 on January 15, 2012, 04:53:28 AM
Quote from: Chas Large on January 15, 2012, 04:15:36 AM
Just tested it on my test forum but the banner does not display as the URL seems to be changed or you've moved your site. Even placing just the banner URL in the address bar gave me a page offering the site for sale? Anyway.

Were you referring to me or Pinball? I am not having any problems with my site that I know of. I have actually taken a different approach so I am not using the flash header. That may change in the future so this post will come in handy.

-Thanks
I quoted Pinball and pointed to his code. Hope this helps you in future. :)
My Modifications :)  My Forum

Please DO NOT PM me with support requests. Post the problem in the appropriate Support Board so everyone can benefit from the advice given.

Pinball Nation

#19
Thanks Chas,Now it works in both Default and Core theme's.I hope this helps others wanting to add a flash banner to the header.

Advertisement: