Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#121 2008-10-06 17:24:24

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

Re: smd_random_banner: Random banner image for advertising

Thanks für your help! it works now.

Last edited by SuMu (2008-10-06 17:29:20)


viele Grüße
SuMu

Psychomuell + blogZicke

Offline

#122 2008-10-15 21:20:37

progre55
Member
Registered: 2006-05-02
Posts: 668

Re: smd_random_banner: Random banner image for advertising

Bloke:

I may have missed it some place, and sorry if I have, but can I have this plug in display a set number of random banners … ie I have 10 images in a category and I want to randomly display 5 at one time.

Found my answer

Want more than one image sent out at once? Add the limit parameter. Give it a number and it’ll be happy. Defaults to 1 image. If you wish to add a class to each img tag, use the imgclass option.

Thank you in advance for your time.

progre55

Last edited by progre55 (2008-10-15 21:22:49)

Offline

#123 2008-11-04 20:31:05

coleh
Member
From: Edinburgh, UK
Registered: 2007-08-16
Posts: 28
Website

Re: smd_random_banner: Random banner image for advertising

Loving the plugin Stef
Is it possible to have wraptag and break attributes in the tag call – I might have missed this elsewhere in the topic but seems like a logical inclusion to me.
Keep up the good work amigo,

Cole


Jack of all trades, Doctor of one

Offline

#124 2008-11-04 20:44:48

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

Re: smd_random_banner: Random banner image for advertising

coleh wrote:

Is it possible to have wraptag and break attributes in the tag call

Yeah, you’re right they should be in there somewhere. For the life of me I can’t remember why I’ve not put them in. There was probably a reason… or perhaps because it was my first plugin I never realised the significance of wraptag and break back then.

Either way, I’ll add it to the list for investigation in the next release. Thanks for letting me know, and glad you like the plugin.


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

Online

#125 2008-11-07 18:28:11

Timid&friendly
Member
From: The Netherlands
Registered: 2006-05-28
Posts: 252
Website

Re: smd_random_banner: Random banner image for advertising

Just a quick note to say, I think this plugin is great!!

THANK YOU VERY MUCH

I think, therefore I AM, … … er … I think :-?

Offline

#126 2008-11-10 22:37:36

Destry
Member
From: Haut-Rhin
Registered: 2004-08-04
Posts: 4,909
Website

Re: smd_random_banner: Random banner image for advertising

Bloke wrote:

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.

Stef, do you mean the help might need edited down, as in understandable but shorter? If so, I could look into it. I’m not currently using this plugin, but it’s one of those that I think is so cool I could probably find a reason to somewhere, even if it wasn’t for ads, per se. :)

Offline

#127 2008-11-10 22:58:45

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

Re: smd_random_banner: Random banner image for advertising

Destry wrote:

do you mean the help might need edited down, as in understandable but shorter?

Yes, it was my first plugin and the syntax and options are so vast that the documentation is like trying to read the Death Star Owners’ Manual. It needs to be gone through, edited right down and laid out more logically, removing duplication and making things terser so it doesn’t take the best part of a day to wade through it. And then still leave you with a migraine.

If so, I could look into it.

It would be awesome if you could. I have some options to add courtesy of coleh spotting the missing wraptag/break which are probably easy to add (probably, although it’s worrying why I missed them in the first place — there may be a legit reason). But as it stands now, the docs are somewhat impenetrable so any help in making them easier to digest would be totally amazing.

I’m not currently using this plugin, but it’s one of those that I think is so cool I could probably find a reason to somewhere…

Ta! Yeah, the number of times I find a use for it is unreal. Embedding flash and passing a tonne of flashvar options is one of them — like on the Adaptive Signage site I’m finishing. It has some layout issues still; and no prizes for guessing where the “Why choose…” idea came from :-) Good ol’ smd_random_text does that bit.

smd_random_banner is also useful just for spicing up a page with a random pic or three. I’m currently experimenting with using it to chain flash movies together, but my Flash skills are somewhat non-existent :-(

Last edited by Bloke (2008-11-10 23:05:46)


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

Online

#128 2008-11-10 23:26:29

Destry
Member
From: Haut-Rhin
Registered: 2004-08-04
Posts: 4,909
Website

Re: smd_random_banner: Random banner image for advertising

Bloke wrote:

It would be awesome if you could.

OK then.

Offline

#129 2008-11-25 08:04:36

shi
Member
Registered: 2005-12-09
Posts: 34

Re: smd_random_banner: Random banner image for advertising

I don’t know if I’m doing something wrong here but I can’t make it work with swf files. Images are displayed correctly, but swf files are visible only in Internet Explorer. In any other browser I see only a white box.

Here’s the code:

<txp:smd_random_banner category="banner-middle" limit="20" subcats="all" mode="file" global_params="width=185;" link_in="description" />

..and the output:

<object height="75" width="185" id="id1001591639" data="http://www.mysite.com/file_download/8" type="application/x-shockwave-flash"> <param value="http://www.mysite.com/file_download/8" name="movie"/> </object>

When I manually change file-url to http://www.mysite.com/files/mybanner.swf it works in all browsers. So, is there a way to change file-url-mode? Or maybe I’ve made a mistake somewhere in the code and there’s no need for a different file-url-mode…

Second thing that bothers me is: when I switch to swfobject mode, plugin generates all the javascript code I need but a it doesn’t generate an empty div (with an ID same as the randomly generated ID in javascript) which is needed to display content in.

Any suggestion?

Last edited by shi (2008-11-25 08:05:20)

Offline

#130 2008-11-25 11:25:49

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

Re: smd_random_banner: Random banner image for advertising

shi wrote:

swf files are visible only in Internet Explorer. In any other browser I see only a white box.

Curious; normally it’s the other way round! It does indeed look as if the problem is the fact it’s using file_download instead of files. You can switch it over to use raw files mode by specifying count_downloads="0" (because any direct access to the files dir bypasses TXP’s counting mechanism). Perhaps I should rename that option to use_raw_files or something and just mention in the docs that if you use it, TXP won’t count downloads …? Bit of a stupid attribute name in retrospect *sigh*

I don’t know why your host or TXP install is not delivering file_download style URLs to some browsers. Works for me on all the servers I’ve tested it on, but I live and learn!

… swfobject mode, plugin generates all the javascript code I need but a it doesn’t generate an empty div (with an ID same as the randomly generated ID in javascript) which is needed to display content in.

Correct. This is a bit of bugbear of mine too, but to add support for it (since the replacement HTML does not necessarily have to be a div) would mean adding more incomprehensibly-named options to the plugin so you can specify the output wraptag, class and so on; the plugin doesn’t even have its own wraptag/break/class yet, so they need adding as well.

When I incorporated support for SWFObject (v1.5, it still doesn’t officialy support swfobject 2.0 — yet another feature that needs to go in!) I guess I didn’t test it with a limit greater than 1 and always hard-coded my elementID. Of course, as you found, with multiple objects on a page this is impractical and, to put it bluntly, crap code.

In my defence, the plugin is over 2.5 years old and was my first attempt at learning the TXP ropes. It has grown far beyond anything I thought possible since then, and with all the extensions and hacks I’ve put in has probably reached the end of its useful life.

I’m increasingly of the opinion that I should start again from the ground up and build a generic plugin that can insert embeddable content (image/file) with all the randomness and filterability of smd_random_banner thrown in for good measure, as a side-effect.

I’d build in the necessary wraptag/break/class stuff, simplify the syntax, make it a container, allow you to specify a form to layout stuff the way you want it, allow you to define your own content type templates (probably via a form) and possibly incorporate some kind of replacement variable system like smd_gallery so you can do, for example:

<div id="{smd_rb_elementid}"></div>
<script type="text/javascript">
   swfobject.embedSWF("{smd_rb_url}", "{smd_rb_elementid}", "{smd_rb_width}", "{smd_rb_height}", "{smd_rb_playerversion}");
</script>

(the plugin would of course use a default layout exactly like that if you chose not to customise it with a form/container).

The thing I haven’t reconciled yet is how to inject the javascript in the <head> — as they state it should be done in the swfobject manual. It may involve having a separate tag that you can use to position the placeholder on your page. That is, you put the random_banner tag in your <head> which sets all the js up, and then somewhere further down the page you put another tag to say “this is where I want the content to go”.

I have absolutely no idea how to do that (besides writing incredibly ugly code) which is why I haven’t tackled it with any gusto. I tried that approach with smd_gallery to better serve slideshow2 content but it got very ugly very quickly (and quickly broke down on article list pages). It’s filed under “to investigate” in my brain, though.

So the short answer is — for now — the plugin can’t do that sort of thing out of the box with swfobject. You are limited to pretty much one banner position with a fixed elementid. You could try hacking the plugin, though. Go down to line 50ish and look for the SWFObject template where it says "SWFObject" => array('<script type=".... Insert this immediately before the opening <script:

<div id="@@elementid"></div>

And see how you get on. That should add the div for you and give it the correct element ID.

Sorry it’s not quite what you expected and is frustrating to work with. Hindsight is a mixed blessing; I can see much better ways of doing it now, but kinda wished I’d thought of them before!

Last edited by Bloke (2008-11-25 11:26:50)


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

Online

#131 2008-11-25 23:28:51

shi
Member
Registered: 2005-12-09
Posts: 34

Re: smd_random_banner: Random banner image for advertising

Bloke wrote:

You can switch it over to use raw files mode by specifying count_downloads="0" (because any direct access to the files dir bypasses TXP’s counting mechanism).

Thank you for this! It works now. +1 vote for renaming that option and mentioning what it does in docs.

About swfobject hack… That works too. It does create a div with a random ID for each banner, but it has 2 downsides so I turned it off. First thing; if I upload an image (with a link in a file-description) and set a plugin options to mode="file" and global_params="mime_type=swo;" – link on that image/banner is not clickable. I know why this is happening but I don’t know if there’s a way to fix this in some future version. And the other downside of swfobject mode, as you’ve mentioned, is a lack of support for swfobject 2.0.

If you consider writing an update for this plugin, I’d like to see a possibility to add 3 fields to file-upload dialog box if it’s possible: width, height, link. As for now, client need to write/code these 3 parametars manually for each banner if it’s not a default size. (width=500; height=76; link_url=http://www.somewebsite.com;)

So, anyway, it’s all working fine now. I’ll make a small donation to you when I finish this project. Cheers and thanks again.

Offline

#132 2009-01-06 17:09:51

strawberryfusion
Member
Registered: 2005-07-24
Posts: 20

Re: smd_random_banner: Random banner image for advertising

Hi,

Is it possible to use this for displaying banners / images in a certain order and changing by themselves. Really like a slide show, which you can click a link on?

I’ve got the basic banner working but cannot see anything to change the time set to display the banner and change it for another?

Thanks
rajiv

Offline

Board footer

Powered by FluxBB