Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2011-02-04 22:24:17

n2
Member
Registered: 2011-01-25
Posts: 56

How to replace a GIF images with an SWF slideshow (in sidebar)

Hi, I’m back and this time it’s a slideshow embedding question!

I need to replace a GIF image in the sidebar with a SWF file.
I tried noodling around in a test sidebar file (form) I created, but no luck.

Here’s the code to the existing sidebar:

<!-- sidebar -->
<div id="content_feature">
<fieldset id="upcoming-events" class="">
<legend>Evening Classes</legend>
<a href="http://www.oursite.org/gp-evening-class"><img src="images/117.jpg" width="185" height="125"></a>
</fieldset>
</div>

And here’s the script code that works on another page which has a slideshow on it. The code works, i just don’t know where in the sidebard code to put it so it replaces that image:

<p id="api_slideshow"><a href="http://www.macromedia.com/go/getflashplayer"></a></p>
<script type="text/javascript" src="http://oursite.org/embed/swfobject.js"></script>

<script type="text/javascript">
var s1 = new SWFObject("http://www.oursite.org/sidebar_slideshow.swf","rotator","185","125","7");
s1.addParam("allowfullscreen","true");
s1.addParam('allowscriptaccess','always');
s1.addParam("wmode","opaque");
s1.addParam('flashvars','&file=http://oursite.org/api/slideshow/<txp:custom_field name="slideshow" />/&config=http://oursite.org/embed/rotatorconfig.xml');
s1.write("api_slideshow");
</script>

I’d really appreciate some guidance with this.

Many thanks…
n2

Last edited by n2 (2011-02-04 22:36:58)


If code is poetry, I’m a lousy poet.

Offline

#2 2011-02-05 22:03:26

jsoo
Plugin Author
From: NC, USA
Registered: 2004-11-15
Posts: 1,793
Website

Re: How to replace a GIF images with an SWF slideshow (in sidebar)

If this is just for the homepage (BTW, there’s no reason not to include an actual link to the site; makes it much easier for people to help, and there’s no security issue as long as the site uses reasonable usernames and passwords for logging into Txp), the swfobject.js script is already loaded, so you don’t need it again. (The script is supposed to be loaded in the page head, but seems to be working as is.)

I’m not familiar with this particular setup for swfobject. Standard instructions here. Might work to copy your working slideshow code, using a different id value for the p (and correspondingly in the last line of the script), also substituting appropriate values in the first line of the script, and probably deleting the flashvars line entirely. Probably also should use s2 or something in place of s1 for the new script. I suspect more tweaking may be required to get it working.


Code is topiary

Offline

#3 2011-02-05 22:18:12

n2
Member
Registered: 2011-01-25
Posts: 56

Re: How to replace a GIF images with an SWF slideshow (in sidebar)

Yikes, not sure i can follow all that. :(

I was hoping i could just replace the GIF image code in order to point to and play the right SWF slideshow, but i know Flash scripts are a whole other animal.

I’ll see if i can follow your instructions & make it work.

Thanks, n

jsoo wrote:

If this is just for the homepage (BTW, there’s no reason not to include an actual link to the site; makes it much easier for people to help, and there’s no security issue as long as the site uses reasonable usernames and passwords for logging into Txp), the swfobject.js script is already loaded, so you don’t need it again. (The script is supposed to be loaded in the page head, but seems to be working as is.)

I’m not familiar with this particular setup for swfobject. Standard instructions here. Might work to copy your working slideshow code, using a different id value for the p (and correspondingly in the last line of the script), also substituting appropriate values in the first line of the script, and probably deleting the flashvars line entirely. Probably also should use s2 or something in place of s1 for the new script. I suspect more tweaking may be required to get it working.


If code is poetry, I’m a lousy poet.

Offline

#4 2011-02-06 00:18:50

n2
Member
Registered: 2011-01-25
Posts: 56

Re: How to replace a GIF images with an SWF slideshow (in sidebar)

Thank you; I was able to get it to work.

All i did was the following:

1) Changed the id value for the p
2) Changed the s1.write value to be the same as the new id value
3) Pasted the code inside the first “Legend” fieldset tags in the sidebar form

Many many thanks for your help with this.

(Now i’m trying to figure out how to get the new PNG header-banner image to showup. They wanted me to change out the GIF because the transparency has jagged edges. I’ve uploaded the file and changed the stylesheet to point to it, but it still links to the old GIF file. Cannot figure out why…)

Last edited by n2 (2011-02-07 16:11:10)


If code is poetry, I’m a lousy poet.

Offline

#5 2011-02-06 00:33:16

jsoo
Plugin Author
From: NC, USA
Registered: 2004-11-15
Posts: 1,793
Website

Re: How to replace a GIF images with an SWF slideshow (in sidebar)

Right, you need to leave the original script as is, then copy it with the suggested changes. Looks like you’ve got both the script and the header image worked out now.


Code is topiary

Offline

#6 2011-02-06 00:38:33

n2
Member
Registered: 2011-01-25
Posts: 56

Re: How to replace a GIF images with an SWF slideshow (in sidebar)

The flash banners are both working (thanks again!) but I’m still puzzled as to why the page still shows the old GIF header banner when i changed the link/code in all the site’s stylesheets & uploaded the new PNG file.

I tried it a few times but it’s as if i didn’t change anything at all, even if you look at the page source.

Most baffling!


If code is poetry, I’m a lousy poet.

Offline

#7 2011-02-06 01:22:31

jsoo
Plugin Author
From: NC, USA
Registered: 2004-11-15
Posts: 1,793
Website

Re: How to replace a GIF images with an SWF slideshow (in sidebar)

The new banner is there; you probably have an overly-persistent browser cache.


Code is topiary

Offline

#8 2011-02-06 03:21:28

n2
Member
Registered: 2011-01-25
Posts: 56

Re: How to replace a GIF images with an SWF slideshow (in sidebar)

That explains it!

Thanks JS for all your help. You’ve made my life easier on multiple occasions now. :)

jsoo wrote:

The new banner is there; you probably have an overly-persistent browser cache.


If code is poetry, I’m a lousy poet.

Offline

Board footer

Powered by FluxBB