Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#109 2008-02-25 23:48:39

johnno
Member
Registered: 2007-06-14
Posts: 30

Re: smd_random_banner: Random banner image for advertising

That was quick!

btw, you are using mode=“file” in the random_banner tag, right? ;-)

Mercifully yes (phew!). Here’s a live example:
<txp:smd_random_banner mode="file" match_text="all" />
<txp:smd_random_banner mode="file" match_text="banner" />

The .flv produces this:
bc. <object type=“application/x-shockwave-flash” data=“http://www.ardess.org/file_download/14” width=“300” height=“75” id=“id1330429131”><param name=“movie” value=“http://www.ardess.org/file_download/14” />@

The .swf produces this:
bc. <object type=“application/x-shockwave-flash” data=“http://www.ardess.org/file_download/11” width=“300” height=“75” id=“id2140127623”><param name=“movie” value=“http://www.ardess.org/file_download/11” />@

In both cases the dimensions are incorrect (but then I’m only tip-toeing through this one step at a time!) You may observe that these are two entirely different files; but for our purposes one is a .swf and the other a .flv which is all that matters.

The former fails to display, the latter looks reasonable.

And the chunk of code that does work (despite being a bit rough as it’s only a cut&paste job):

  <object width="320" height="240" id="id1372324200" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,115,0 "> <param name="salign" value="lt"> <param name="quality" value="high">   <param name="scale" value="noscale"> <param name="wmode" value="transparent"> <param name="movie" value="http://www.ardess.org/files/flvplayer.swf?file=http://www.ardess.org/files/all.flv> <param name="FlashVars" value="&streamName=FLV_Video_URL&autoPlay=true&autoRewind=true">  <embed width="320" height="240" flashvars="&streamName=FLV_Video_URL&autoPlay=true&autoRewind=true" quality="high" scale="noscale" salign="LT" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" src="http://www.ardess.org/files/flvplayer.swf?file=http://www.ardess.org/files/all.flv" wmode="transparent" /></object>

Having the 'flvplayer.swf' file through which to play "all.flv" seems to be essential. And that's the limit of my knowledge on the subject.
Over to you!

(Sorry, I've made a hash of posting the code snippets etc.)

Last edited by johnno (2008-02-25 23:52:08)

Offline

#110 2008-02-26 00:37:29

Bloke
Developer
From: Leeds, UK
Registered: 2006-01-29
Posts: 11,448
Website GitHub

Re: smd_random_banner: Random banner image for advertising

johnno wrote:

The .flv produces this: <object type=“application/x-shockwave-flash” data=“http://www.ardess.org/file_download/14” width=“300” height=“75” id=“id1330429131”><param name=“movie” value=“http://www.ardess.org/file_download/14” />

Right, looks good to me. My guess is I’ve stuffed up the MIME type then and looking around on the web (which I should have done before releasing the plugin *sigh*) they claim that the flv mime type should be video/x-flv … some even mention application/octet-stream, some say it should be both… in which case I’m stuffed :-(

You could try editing the plugin but I don’t think it’ll work (see later). If you did want to check it out and report success or otherwise, near the top of the plugin, find:

$objMimeType = array("avi" => array("video/avi", "Video"),
				"fla|flac" => array("audio/flac", "Audio"),
				"flv|swf" => array("application/x-shockwave-flash", "Flash"),

and change it to:

$objMimeType = array("avi" => array("video/avi", "Video"),
				"fla|flac" => array("audio/flac", "Audio"),
				"flv" => array("video/x-flv", "Flash"),
				"swf" => array("application/x-shockwave-flash", "Flash"),

The downside is I still don’t think it’ll play because there isn’t a native FLV player as far as I can make out; they all use some kind of flash player to simulate it. This is verified by your “working” code:

<param name="movie" value="http://www.ardess.org/files/flvplayer.swf?file=http://www.ardess.org/files/all.flv">

One other thing you could try is to hack the plugin again and manually add in support for your flv player, as follows. Near the top of the plugin again, make sure the code reads:

$objMimeType = array("avi" => array("video/avi", "Video"),
				"fla|flac" => array("audio/flac", "Audio"),
				"flv" => array("application/x-shockwave-flash", "FlashFLV"),
				"swf" => array("application/x-shockwave-flash", "Flash"),

Then, a few lines further on in the code, find this:

$objTemplate = array(
	"Flash" => array('<object ' .$objTemplateFixed. 'id="@@id"><param name="movie" value="@@data" />', '</object>'),

and add this line immediately afterwards:

"FlashFLV" => array('<object type="@@type" data="http://www.ardess.org/files/flvplayer.swf?file=@@data" width="@@width" height="@@height" @@others id="@@id"><param name="movie" value="http://www.ardess.org/files/flvplayer.swf?file=@@data" />', '</object>'),

What that’s essentially doing is adding a custom handler for FLV types that uses your flvplayer. I originally planned to offer this functionality via the plugin options, but it was too messy in its current form and required a rethink. No guarantees that code’ll work but it might be worth a try. My guess is you might be better off using SWFObject instead, because that’s supposed to handle stuff like this for you. Failing that, beer helps :-)

In both cases the dimensions are incorrect (but then I’m only tip-toeing through this one step at a time!)

Good idea :-) For reference, you can either add the width and height values to the “description” field of each relevant file or use the global_params plugin attribute to specify a fixed default size for all video.


The smd plugin menagerie — for when you need one more gribble of power from Textpattern. Bleeding-edge code available on GitHub.

Txp Builders – finely-crafted code, design and Txp

Offline

#111 2008-02-26 09:52:25

johnno
Member
Registered: 2007-06-14
Posts: 30

Re: smd_random_banner: Random banner image for advertising

Effected changes, but no go.

And though
<txp:bas_flvplayer video='/files/all.flv' player='/files/flvplayer.swf' />
has tested OK in Firefox (Mac), it still fails to display in Safari (Mac) when smd_slimbox is active on the same page.

Offline

#112 2008-02-26 10:23:15

Bloke
Developer
From: Leeds, UK
Registered: 2006-01-29
Posts: 11,448
Website GitHub

Re: smd_random_banner: Random banner image for advertising

johnno wrote:

Effected changes, but no go.

Thought so. Damn.

<txp:bas_flvplayer video='/files/all.flv' player='/files/flvplayer.swf' />
has tested OK in Firefox (Mac), it still fails to display in Safari (Mac) when smd_slimbox is active on the same page.

Well if you’re not using the “random” nature of random banner, bas_flvplayer is certainly a helluva lot simpler :-) As to the clash, if it works ok in firefox and not safari it sounds browser specific to me, but I’m willing to admit it may be plugin related.

First port of call though, since I don’t have access to a Mac to check it out, is to have a look at Christophe’s forums for a possible solution. Lots of people embedding stuff and trying to marry slimbox on the same page. Sorry if it seems I’m giving you the run-around at the mo; I’m a bit stumped!


The smd plugin menagerie — for when you need one more gribble of power from Textpattern. Bleeding-edge code available on GitHub.

Txp Builders – finely-crafted code, design and Txp

Offline

#113 2008-02-26 13:32:23

johnno
Member
Registered: 2007-06-14
Posts: 30

Re: smd_random_banner: Random banner image for advertising

Definitely browser specific – though I assume a plugin should be able to cope with that ;-)

Some further info
Setting aside <txp:bas_flvplayer video='/files/all.flv' player='/files/flvplayer.swf' /> for the moment, as it’s behaviour seems to be erratic:

In Safari
IF smd_slimbox is active and used for the display of article images
AND the raw <object> code is PRECEDED by TWO OR MORE separate articles (each of which has an image included)
THEN the .flv will FAIL to display.

Place the code BEFORE the articles and there is no problem.
Or if the code is preceded by only a SINGLE article with image, again there is no problem.

(including the proviso that the wind IS south-westerly, naturally)

Hope this sheds some light on the issue.

Offline

#114 2008-02-26 14:02:28

Bloke
Developer
From: Leeds, UK
Registered: 2006-01-29
Posts: 11,448
Website GitHub

Re: smd_random_banner: Random banner image for advertising

johnno wrote:

Definitely browser specific – though I assume a plugin should be able to cope with that ;-)

You’d like to think… ;-)

IF smd_slimbox is active and used for the display of article images
AND the raw <object> code is PRECEDED by TWO OR MORE separate articles (each of which has an image included) THEN the .flv will FAIL to display. Place the code BEFORE the articles and there is no problem.
Or if the code is preceded by only a SINGLE article with image, again there is no problem.

wtf? That’s freaky. Article lists, I assume? Can you send me a URL or two (privately if you prefer) showing both behaviours please? I’d like to see the output on Firefox here. When I get home I’ll see if I can check it out on OSX. I know there are some weird browser issues with (swf)object and embed tags. Vittorio had some with slimbox. You may find some joy or ideas if you trawl through the slimbox thread from there onwards, and it might be quicker than waiting for me to get home!

btw, are you using hak_textile_tags?

(including the proviso that the wind IS south-westerly, naturally)

Computers, eh? Who’d ‘ave em…


The smd plugin menagerie — for when you need one more gribble of power from Textpattern. Bleeding-edge code available on GitHub.

Txp Builders – finely-crafted code, design and Txp

Offline

#115 2008-02-27 10:36:03

johnno
Member
Registered: 2007-06-14
Posts: 30

Re: smd_random_banner: Random banner image for advertising

wtf? That’s freaky.

Spot on! Seems I’ve been barking up the wrong red herring. Clean install on fresh site with stripped down page has exonerated smd_slimbox (hurrah!).
Basically, it’s just Safari being a pig with multiple swf(object) tags.

To recap:
<txp:smd_random_banner mode="file" match_text="swf" /> remains a winner, but <txp:smd_random_banner mode="file" match_text="flv" /> isn’t there yet.

Offline

#116 2008-04-29 14:25:20

mattmikulla
Member
From: Nashville Tennessee
Registered: 2004-08-25
Posts: 281
Website

Re: smd_random_banner: Random banner image for advertising

I’m a little confused here. Can I output a raw url without a link or img tag. For example: http://mysite.com/images/23.jpg


Art Rogue – Fine Art Photography

Offline

#117 2008-04-29 14:28:38

Bloke
Developer
From: Leeds, UK
Registered: 2006-01-29
Posts: 11,448
Website GitHub

Re: smd_random_banner: Random banner image for advertising

mattmikulla wrote:

Can I output a raw url without a link or img tag. For example: http://mysite.com/images/23.jpg

Yup, use raw_url="1"


The smd plugin menagerie — for when you need one more gribble of power from Textpattern. Bleeding-edge code available on GitHub.

Txp Builders – finely-crafted code, design and Txp

Offline

#118 2008-04-29 15:44:34

Bloke
Developer
From: Leeds, UK
Registered: 2006-01-29
Posts: 11,448
Website GitHub

Re: smd_random_banner: Random banner image for advertising

Forgot all about this. I’ve got a new version that I’ve been sitting on:

  • new id attribute so you can now pick from groups of image IDs as well as categories
  • compare_to can now take ID as well
  • display_url allows you turn on or off the plugin’s insistence at publically displaying any URL in the caption/alt text (thanks Andrew Blevins for the idea)
  • subcats is now expanded to be able to pick how many levels to go down. if you previously used subcats=“1”, this will now only go down one level; if you want to look at all sub-categories, use subcats="all"
  • link_in can now use name as well as alt or caption if you wish to hijack the image filename for its destination url (just gives one more option so you can now use both caption and alt as intended while still retaining the ability to link to another URL on image click)
  • imgclass is now renamed class for consistency
  • removed id_prefix since it’s no longer needed. Newly refactored code and smd_lib_v0.32 mean you can put multiple replacement sequences in one element and mix that with fixed text. e.g. category="article-?id, mycat_?c_?s" would choose from categories labelled article-42 and mycat_lion_animals if the user was looking at an article with ID 42 in category lion, section animals
  • Bug fix in swfobject mode when using FlashVars

Give v0.4 [ compressed version ] a spin and let me know how you get on. The size of this beast is approaching critical so you’re probably better off with the compressed version. While the plugin is actually shorter than before thanks to the new smd_lib, the help is bigger so I have to find a better (more compact) way to write the help. Anyone with any ideas, please holler.


The smd plugin menagerie — for when you need one more gribble of power from Textpattern. Bleeding-edge code available on GitHub.

Txp Builders – finely-crafted code, design and Txp

Offline

#119 2008-10-06 14:54:25

SuMu
Member
From: Germany - Wuppertal
Registered: 2008-03-06
Posts: 242
Website

Re: smd_random_banner: Random banner image for advertising

Hello Bloke

I would have only a klickable random header, but I don’t understand the code :-(

<txp:smd_random_banner category=“random”
link_in=“mysection” display_url=“1” />

this is not korrekt, it shows only the image, but it’s not klickable…

Please could you help me?

Thanks.


viele Grüße
SuMu

Psychomuell + blogZicke

Offline

#120 2008-10-06 15:15:46

Bloke
Developer
From: Leeds, UK
Registered: 2006-01-29
Posts: 11,448
Website GitHub

Re: smd_random_banner: Random banner image for advertising

SuMu wrote:

it shows only the image, but it’s not klickable…

To make a banner clickable you must tell the plugin two things:

  1. Where to find your desired destination URL, via the link_in attribute. This can currently be either: name, alt or caption
  2. The actual URL in the image field you specified.

So for example, if you wanted to use the ‘caption’ to hold your URL and had a banner image of a lion that you wanted to link to the /zoo/wild-cats article, you would:

  1. visit TXP’s Images tab, open up the picture of your lion
  2. make sure it is in the relevant category (e.g. ‘random’ in your case)
  3. type in /zoo/wild-cats in the ‘caption’ field, then save the changes
  4. find your smd_random_banner tag and add link_in="caption"

Then whenever the ‘lion’ image is displayed, it will be clickable. Note that all other images in the same category should also have a URL given in their ‘caption’ fields or you will get some very odd URL for all other banner images!

Does that help?

EDIT: you may wish to use display_url="0" to hide the caption URL in this case.

Last edited by Bloke (2008-10-06 15:18:34)


The smd plugin menagerie — for when you need one more gribble of power from Textpattern. Bleeding-edge code available on GitHub.

Txp Builders – finely-crafted code, design and Txp

Offline

Board footer

Powered by FluxBB