Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#31 2006-09-30 13:54:56

lukepermsn
Member
From: london
Registered: 2004-07-15
Posts: 57
Website

Re: smd_random_banner: Random banner image for advertising

genius :-)

<code><backflip /></code>

L.


“Absorb what is useful, Discard what is not, Add what is uniquely your own” – Bruce Lee

Offline

#32 2006-10-06 20:57:39

Kjeld
Member
From: Tokyo, Japan
Registered: 2005-02-05
Posts: 465
Website

Re: smd_random_banner: Random banner image for advertising

Stef,

Great plugin. Thanks for all the great work!

It displays perfectly and the images load really quickly. Unfortunately, the plugin is not generating any links. I am sure I am doing something wrong, but I can’t figure it out.

  • This is my tag: <code>
    <txp:smd_random_banner category=“front-page” linkcaption=“1” />
    </code>
  • Links were added to the caption fields of the images.
  • I am using Textpattern · 4.0.3

I hope you may be able to help me out here. :-)

Speak to you soon (from Japan!),

Kjeld


Old Photos of Japan – Japan in the 1850s~1960s (100% txp)
MeijiShowa – Stock photos of Japan in the 1850s~1960s (100% txp)
JapaneseStreets.com – Japanese street fashion (mostly txp)

Offline

#33 2006-10-17 04:00:09

mercury
Member
Registered: 2006-05-12
Posts: 26

Re: smd_random_banner: Random banner image for advertising

about generating links in v0.15
i suggest to wait for clearing from author

as for me i did the following: (i’m not a coding junkie, so it seems like just temp. solution)
find: <code>smd_rs_out($rs)</code>
change to: <code>smd_rs_out($rs,$linkcaption)</code>
(3 times)

and one more thing:
now, if you leave caption filed blank the link of the images will lead you to site root. if you want to have these images displayed without link (as i think more proper, except content of your image intended to link to your head page), do the following:

find:
<code> if ($linkcaption) { $linkName=trim($row[‘caption’]);
</code>
change to:
<code> $linkName=trim($row[‘caption’]); if ($linkcaption && $linkName) {
</code>

Offline

#34 2006-10-17 07:39:41

Kjeld
Member
From: Tokyo, Japan
Registered: 2005-02-05
Posts: 465
Website

Re: smd_random_banner: Random banner image for advertising

Thanks, mercury! It works as a gem.


Old Photos of Japan – Japan in the 1850s~1960s (100% txp)
MeijiShowa – Stock photos of Japan in the 1850s~1960s (100% txp)
JapaneseStreets.com – Japanese street fashion (mostly txp)

Offline

#35 2006-10-17 22:51:15

mercury
Member
Registered: 2006-05-12
Posts: 26

Re: smd_random_banner: Random banner image for advertising

oh, gosh! the randomness is leaked with 4.0.4 ((

Offline

#36 2006-10-17 23:28:27

Kjeld
Member
From: Tokyo, Japan
Registered: 2005-02-05
Posts: 465
Website

Re: smd_random_banner: Random banner image for advertising

mercury wrote:

oh, gosh! the randomness is leaked with 4.0.4 ((

What do you mean?


Old Photos of Japan – Japan in the 1850s~1960s (100% txp)
MeijiShowa – Stock photos of Japan in the 1850s~1960s (100% txp)
JapaneseStreets.com – Japanese street fashion (mostly txp)

Offline

#37 2006-10-18 02:12:20

mercury
Member
Registered: 2006-05-12
Posts: 26

Re: smd_random_banner: Random banner image for advertising

it is random banner image. but for a certain circumstances in new 4.0.4 txp the images doesn’t rotate and almost everytime i see the same image on the page. in 4.0.3 all worked fine.

Offline

#38 2006-10-18 21:51:36

mercury
Member
Registered: 2006-05-12
Posts: 26

Re: smd_random_banner: Random banner image for advertising

solved. Send Last-Modified Header in preferences set to “no”

Offline

#39 2006-10-20 07:16:07

Kjeld
Member
From: Tokyo, Japan
Registered: 2005-02-05
Posts: 465
Website

Re: smd_random_banner: Random banner image for advertising

Thanks!


Old Photos of Japan – Japan in the 1850s~1960s (100% txp)
MeijiShowa – Stock photos of Japan in the 1850s~1960s (100% txp)
JapaneseStreets.com – Japanese street fashion (mostly txp)

Offline

#40 2006-10-21 16:09:46

Bloke
Developer
From: Leeds, UK
Registered: 2006-01-29
Posts: 12,463
Website GitHub

Re: smd_random_banner: Random banner image for advertising

Sorry for the delay in replying guys. I thought I was subscribed to the topic but wasn’t, so I didn’t spot your problems until just now.

mercury wrote:

about generating links in v0.15 i suggest to wait for clearing from author

You’re exactly right mercury. I’d made a function so I didn’t have to repeat a large chunk of code and forgot to pass the linkcaption in. I’d also made the same mistake with referer. Dumbass dumbass dumbass. That then had the knock-on effect of breaking the code if you left the caption blank, as you spotted.

sigh that’ll teach me not to check the code in “Testing” or “Debug” mode on a site. Many thanks for putting that right mercury. That’s the 2nd time you’ve bailed me out: I owe you a pint if you’re ever round this way.

My slapdash approach to testing is probably also the reason why I don’t write code for air traffic control :-)

v0.15a is now available that patches these issues. Any more probs, just shout.

Last edited by Bloke (2006-10-21 16:49:05)


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

Hire Txp Builders – finely-crafted code, design and Txp

Offline

#41 2006-10-21 16:21:46

Bloke
Developer
From: Leeds, UK
Registered: 2006-01-29
Posts: 12,463
Website GitHub

Re: smd_random_banner: Random banner image for advertising

mercury wrote:

it is random banner image. but for a certain circumstances in new 4.0.4 txp the images doesn’t rotate and almost everytime i see the same image on the page. in 4.0.3 all worked fine…
solved. Send Last-Modified Header in preferences set to “no”

Curious. Must admit I haven’t downloaded 4.0.4 yet to check the plugin works ok with it (cf above post about lackadaisical testing!)

If Send Last-Modified Header is going to be on by default in 4.0.4 that will cause a problem because it’s likely to keep using the cached copy. Although it’s a bit of a kludge, the only way I can think to get round this is to add a random nonce value to the image so the URL ‘looks’ different to the server each request.

Not pretty, but maybe I should add a cache-defeat="1" option to future releases which adds something like ?rnd=5289AD6B to the url? Any better ideas?


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

Hire Txp Builders – finely-crafted code, design and Txp

Offline

#42 2006-10-21 21:45:00

mercury
Member
Registered: 2006-05-12
Posts: 26

Re: smd_random_banner: Random banner image for advertising

adding rnd will cause browser to instantly download the images, each page refresh. (this will increase your traffic and webserver load) i don’t think this is a good idea.

i’d say it will be much better to give a notice of this behavior in 4.0.4 before downloading of plugin. or auto-set “Send Last-Modified Header” directly in db to 0, and surely notify webmaster about that.

Offline

#43 2006-10-21 23:47:41

Bloke
Developer
From: Leeds, UK
Registered: 2006-01-29
Posts: 12,463
Website GitHub

Re: smd_random_banner: Random banner image for advertising

mercury wrote:

adding rnd will cause browser to instantly download the images, each page refresh. (this will increase your traffic and webserver load) i don’t think this is a good idea.

I’d be inclined to agree. Even though the whole point of smd_random_banner is to get a different image each page load, at some point you will likely get a repeat image; and then it would be a Very Good Thing<sup>(TM)</sup> to have the browser recognise this and retrieve the local cached copy for the reasons you state.

i’d say it will be much better to give a notice of this behavior in 4.0.4 before downloading of plugin. or auto-set “Send Last-Modified Header” directly in db to 0, and surely notify webmaster about that.

I’ll go with the former; mainly since I don’t know how to set the Send Last-Modified Header from the code! Also I don’t think it’s very friendly to mess with someone’s settings.

I have placed a brief ‘Troubleshooting’ section in the help file to highlight the possible problem. Must admit I had no problems here with Send Last-Modified Header in either ‘on’ or ‘off’ state: I got a random image every time. Perhaps that is just luck, or down to my browser settings/hoster.

Anyway, I’ve updated the plugin to v0.16 and fixed a few minor v4.0.4 issues. It is backwards compatible with txp v4.0.3. Enjoy.


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

Hire Txp Builders – finely-crafted code, design and Txp

Offline

#44 2006-10-22 00:41:29

Kjeld
Member
From: Tokyo, Japan
Registered: 2005-02-05
Posts: 465
Website

Re: smd_random_banner: Random banner image for advertising

Thanks for the updates, Stef. It appears to be working well.

I use links in the captions and they now have ‘?-bid=[image number]’ added to them on the page where the image is displayed. I can’t remember noticing that in the earlier versions of smd_random_banner. What is the function of this extra code?


Old Photos of Japan – Japan in the 1850s~1960s (100% txp)
MeijiShowa – Stock photos of Japan in the 1850s~1960s (100% txp)
JapaneseStreets.com – Japanese street fashion (mostly txp)

Offline

#45 2006-10-22 01:11:02

Bloke
Developer
From: Leeds, UK
Registered: 2006-01-29
Posts: 12,463
Website GitHub

Re: smd_random_banner: Random banner image for advertising

Kjeld wrote:

I use links in the captions and they now have ‘?-bid=[image number]’ added to them on the page where the image is displayed. I can’t remember noticing that in the earlier versions of smd_random_banner.

That’s because it was broken in v0.15! :-(

What is the function of this extra code?

It allows you to track which banners have been clicked by your visitors. Look in admin->visitor logs and you’ll see the images with the associated bid (“banner id”) of each visitor who clicked on a banner pic. Very useful to track the effectiveness of your adverts and maybe see which ones generate the best response.

If you don’t need the feature, add referer="" as an attribute. If you would like it to say something else instead of ‘bid’, put that in the quotes of the referer option (e.g. referer="clicked").

Hope that helps.


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

Hire Txp Builders – finely-crafted code, design and Txp

Offline

Board footer

Powered by FluxBB