Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

  1. Index
  2. » Plugin support
  3. » smd_slimbox

#301 2007-10-30 01:43:45

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

Re: smd_slimbox

fuls wrote:

I’ve solved the problem by adding: <txp:category type=“image” title=“1” /> above the smd_slibox tag.

Doh! Of course. Nice one.

I’ll still do the version I planned because it gives even greater control than that for those that want it. I released that other plugin I mentioned and overhauled smd_lib in the process so I can hopefully get back to working on slimbox now.

By the way, in response to a bug found by Mr.Smith there’s a new version out that fixes the fix I fudged up waaay back in v0.24. I also fixed the ‘px’ issue highlighted a few posts ago by robin746. Try version 0.29b for a fuller flavour.

Last edited by Bloke (2007-10-30 01:52: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

#302 2007-11-02 23:33:38

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

Re: smd_slimbox

Damn feature creep! In the process of updating the code to v0.3, I’ve yet again chickened out and brought a few features forward into the v0.2x series. The recent changes to smd_lib have helped smooth the path so I’ve added a couple of improvements to slimbox now to save you waiting.

The docs explain more, but the following changes have been made:

  1. Integer ranges are now only permitted in imageid attributes, so date hacks like this are no longer necessary when dealing with categories that resemble ‘year-month’
  2. The simple ? options can now be embedded in other text. So instead of being limited to category="?s" you can now specify category="?s_pics" , which would resolve to “tiger_pics” if someone was browsing the ‘tiger’ section. The wildcard has to be easily distinguishable from other parts of the text (underscores work well but category="?spics" probably won’t) and you can only use one wildcard per item (so category="?s_?c_pics" won’t work as intended… for now: this may be extended in future if I can figure out how)
  3. Added thumbtext, thumbtextclass and paramdelim options which extends the ability to add text around each thumbnail. These options supercede showalt, showcaption, altclass, captionclass, and textpos, which have all been deprecated (but still work in this version)

Essentially, instead of only being restricted to adding the caption or alt text in one designated position around each thumbnail, you can now add a whole raft of image information from the database and place it in one or more locations around the image. Styling it becomes fun, but is possible with judicial use of CSS selectors.

A few quick examples:

<txp:smd_slimbox category="photos" thumbtext="?caption" />

does exactly the same as <txp:smd_slimbox category="photos" showcaption="1" /> beforehand. But now you can also do this:

<txp:smd_slimbox category="photos" thumbtext="?caption by ?author ( ?date )" />

which might show “The Loch Ness Monster by Stef ( 2007-11-02 10:14:30 )” under a thumbnail.

You could also split it, so some text goes above and some below the thumb:

<txp:smd_slimbox category="photos" thumbtext="above:Photo by ?author, below:?caption" />

You have the same 4 positions available as with the previous textpos option (above, below, before, after).

The thumbtextclass option simply adds a class name to each piece of text (they all get the same one for now) and the paramdelim option is just there in case you want to change thumbtext’s reliance on the ‘:’ to separate the positions from the text.

The version number is slightly unconventional; I ran out of numbers because I’ve been deliberating over v0.3 for too long. But take v0.210 away, play with it and let me know how you get on (note: requires smd_lib v0.3)

Last edited by Bloke (2007-11-03 01:02:06)


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

#303 2007-11-03 12:25:21

vittorio
Member
From: Roma caput mundi
Registered: 2006-02-01
Posts: 122
Website

Re: smd_slimbox

Hi everybody,
I just discovered this wonderful plugin (great job, stef!) and I decided to give it a try. Installing it was quite easy, but now i’m stuck: i have an article which outputs a slimboxed gallery, but the js files work only when you are on the homepage, not when you are on the article page. Take a look: home and article.

I thought that was caused by a wrong inclusion of the scripts in the <head> of the pages, and tried even with absolute urls instead of relative ones: still working only on the homepage. Can anyone understand what’s happening?

Thanks


Happily served with Txp: Strampelli.net, Brain Essence, NicolaTranfaglia.com

Offline

#304 2007-11-03 13:22:23

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

Re: smd_slimbox

vittorio wrote:

the js files work only when you are on the homepage, not when you are on the article page.

I can’t make slimbox work on either page at the moment… very odd. Your paths are all correct, it finds all the relevant files and loads them, your images have all the right stuff in them but the slimbox effect is not working :-(

Two things you could try:

  1. Remove the javascript function externalLinks(). What I think may be happening is the window.onload is wiping out any chance mootols has of starting up the slimbox code. In theory it shouldn’t affect it, because slimbox runs on domready not onload, but it’s one place to look. If that’s the culprit, try using a mootools function to add externalLinks() to the existing list of things to run onload, rather than window.onload which overwrites any other scripts that are scheduled to run. Look at the mootools docs for details on doing that
  2. Temporarily get rid of the swfobject.js script. Sometimes that’s been known to cause problems (search this topic and you’ll find one or two people mention it). Sometimes loading the library in a different place on the page causes slimbox to start working

Past that I can’t see any reason for it not to work. If none of the two things above work, try just stripping things off the page one by one until you find it works, or build a temporary page up from scratch, starting with slimbox and adding things one at a time until you find what causes it to stop working.

Sorry I can’t be of much more use right now. If I think of anything else I’ll let you know.


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

#305 2007-11-03 15:11:17

vittorio
Member
From: Roma caput mundi
Registered: 2006-02-01
Posts: 122
Website

Re: smd_slimbox

Bloke wrote:

Two things you could try:

  1. Remove the javascript function externalLinks(). What I think may be happening is the window.onload is wiping out any chance mootols has of starting up the slimbox code. In theory it shouldn’t affect it, because slimbox runs on domready not onload, but it’s one place to look. If that’s the culprit, try using a mootools function to add externalLinks() to the existing list of things to run onload, rather than window.onload which overwrites any other scripts that are scheduled to run. Look at the mootools docs for details on doing that
  2. Temporarily get rid of the swfobject.js script. Sometimes that’s been known to cause problems (search this topic and you’ll find one or two people mention it). Sometimes loading the library in a different place on the page causes slimbox to start working

Stef,
thank you for your quick help, but…
I disabled all the scripts (except yours, of course) and used the original txp default page and forms. Again, the gallery works when you are on the main page, but it doesn’t when on the article page.

Quite strange, I really don’t understand it…

edit: what library should i load “in a different place”? And where, outside the <head>?

Last edited by vittorio (2007-11-03 15:17:06)


Happily served with Txp: Strampelli.net, Brain Essence, NicolaTranfaglia.com

Offline

#306 2007-11-03 16:40:18

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

Re: smd_slimbox

vittorio wrote:

the gallery works when you are on the main page but it doesn’t when on the article page”.

Aha! Now I see the differences in the pages. Right, the problem appears to be the inclusion of this line:

<script src='http://www.strampelli.net/txp/index.php?js=hak_text-tag' type='text/javascript'></script>

Remove that and slimbox works on both pages. Take out the call to hak_textile-tags in your page template/form and see if it works.

Now, I took a look at Patrick’s code and I’d bet my hat it’s this function that’s causing the problem:

function addEvent(obj, evType, fn){
...
}

That addEvent() function is probably clashing with the one built into mootools. To test this theory, try editing his javascript – looks like you’re using stm_javascript which is good – and delete (or comment out) his addEvent() function.

Next (and I’m not sure where this will be, probably in the hak_textile-tags plugin) you need to find where he adds this line to the page:

addEvent(window, 'load', function() {

Change it to this:

window.addEvent('load', function() {

Save the plugin then reload the page. My guess is that’ll fix it. It’s not an ideal solution and I’m thinking there’s got to be a better way than hacking the plugins. I’ll bounce a message across to Patrick and see if he has any ideas; he’s a far better coder than I am.

Let me know how you get on.


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

#307 2007-11-03 17:22:51

vittorio
Member
From: Roma caput mundi
Registered: 2006-02-01
Posts: 122
Website

Re: smd_slimbox

Bloke wrote:

Let me know how you get on.

I tried to modify hakjoon’s plugin (there’s no external stm_javascript), but it causes the textile_tags bar to disappear, so I simply turned it off (hoping hakjoon’s next release of it will fix this issue), as your slimbox magic-box is more important to my site. And now it goes like a charm! Here it is.

Thank you, stef: a. for your great job in creating this plugin; b. for your great help and for your even greater kindness and attention. Wish my mother-language was english to find the best words to show you my gratitude…

Vittorio

Last edited by vittorio (2007-11-05 15:28:52)


Happily served with Txp: Strampelli.net, Brain Essence, NicolaTranfaglia.com

Offline

#308 2007-11-03 19:08:40

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

Re: smd_slimbox

vittorio wrote:

I simply turned it off (hoping hakjoon’s next release of it will fix this issue)

OK, well at least it’s got you going for now. The thing is, there’s nothing intrinsically wrong with hakjoon’s code (it’s damn good actually!), it’s just an unfortunate side-effect of mootools having its own definition of addEvent() that differs from the one that most people (myself included) tend to use for our javascript.

If a) there’s a way to tell mootools to use its own private version so it won’t clash with any ‘external’ versions of addEvent(), and b) I can wrestle control of that feature into slimbox, I’ll try and fix the code so the plugins can work side-by-side. Thanks for bringing this issue to my attention.

As js libraries increase in popularity, it’ll no doubt affect others at some point in the future so it makes sense to keep plugins as isolated as possible from each other while still keeping an eye out for any way in which they can share resources. That’s why I spent quite a lot of time over smd_pullquote to make sure I gave people the necessary options to avoid library clashes and also take advantage of any libraries that are already installed so page load times are kept short.

Anyway, I’ve sent an e-mail to Patrick to see if he can think of a good way of making the two plugins play nicely together. I’m sure between us we can make it happen. Sorry it’s not working right out of the box for you at the moment and you’ve had to compromise the functionality of your site to accommodate this glitch. Programmers, eh?! :-p

Thank you, stef… wish my mother-language were english to find the best words to show you my gratitude

:-) Thank you very much, you’re most welcome. Your English seems better than mine and certainly better than my Italian!

To be fair, the plugin is largely based on other people’s work, I just extended the idea, packaged it up and added the bells and whistles. Glad you find it useful. If you have any ideas for improvements that aren’t already (one day…) scheduled for implementation, send them over.

In the meantime, either me or Patrick will report back when we’ve worked out a fix.

P.S. nice hallowe’en make-up!

Last edited by Bloke (2007-11-03 19:10:12)


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

#309 2007-11-04 22:57:23

hakjoon
Member
From: Arlington, VA
Registered: 2004-07-29
Posts: 1,634
Website

Re: smd_slimbox

Vittorio,

Stef explained your problem to me, and I’ll have a new version of my code out in a day or so that should resolve the conflict. I’ll post a followup here when it’s up.


Shoving is the answer – pusher robot

Offline

#310 2007-11-05 15:26:23

vittorio
Member
From: Roma caput mundi
Registered: 2006-02-01
Posts: 122
Website

Re: smd_slimbox

hakjoon wrote:

Vittorio,

Stef explained your problem to me, and I’ll have a new version of my code out in a day or so that should resolve the conflict. I’ll post a followup here when it’s up.

Great! I’ll be waiting… thank you Patrick. The txp community is lucky to have such people like you and Stef, I’d be still trying to understand what was happening on my site without him.

Vittorio


Happily served with Txp: Strampelli.net, Brain Essence, NicolaTranfaglia.com

Offline

#311 2007-11-05 19:47:14

vittorio
Member
From: Roma caput mundi
Registered: 2006-02-01
Posts: 122
Website

Re: smd_slimbox

Stef,
i know i’m totally ot but, as you were one of the lasts (and probably the most experienced) to view my blog, do you have any hint on why it does not work on ie? I just discovered this thing, but cannot understand why. Don’t think it’s for your plugin, anyway

Edit: forgot to thank you in advance :-)

Last edited by vittorio (2007-11-05 19:47:55)


Happily served with Txp: Strampelli.net, Brain Essence, NicolaTranfaglia.com

Offline

#312 2007-11-05 23:09:21

vittorio
Member
From: Roma caput mundi
Registered: 2006-02-01
Posts: 122
Website

Re: smd_slimbox

Ehm… ops… maybe I was not so ot in my last post. Seems that your plugin is causing the error on internet explorer. Still working perfectly in ff, though.


Happily served with Txp: Strampelli.net, Brain Essence, NicolaTranfaglia.com

Offline

#313 2007-11-05 23:42:45

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

Re: smd_slimbox

vittorio wrote:

Seems that your plugin is causing the error on internet explorer. Still working perfectly in ff, though.

I assume you’re referring to the odd “Operation aborted” message in IE6 (not sure about IE7, I don’t have it because I don’t use IE ever). Remember a couple of posts ago I mentioned removing the swfobject script. Try removing that and see if the problem goes away.

Alternatively, try removing (hiding) the article that contains the embedded youtube video, and reloading the page. Does the problem go away then? wouaren had a similar issue waaay back on page 1 or 2 of this thread and I think the outcome was that mootools or slimbox.js just plain didn’t agree with the <embed> tag in Internet Explorer. Kind of ironic given that the only reason to use the embed tag is to please Internet Explorer’s broken <object> tag :-p

Since then I’ve noticed it’s not always embed, so perhaps that’s unduly harsh. My guess – and it is only a guess because wouaren fixed it himself and I cannot remember what he did (he may know, ask him, and if you find out, post it here so I know the answer for future!) – is that there’s some odd interaction between either swfobject or <embed> or <object> and IE, possibly when mootools is loaded.

I have no idea what it is or why it happens, just that it does and that (usually) by not using both embed AND object, or by moving the <script src="swfobject.js"> line somewhere else in the page flow (above mootools.js? below it? bottom of the page?) sometimes fixes it. Sometimes not, it’s maddening and I’ve never found the definitive answer :-(

In fact I had it the other day with smd_random_banner using a plain <object> tag (no embed, no swfobject). The first time the page loads in IE6, I get the “operation aborted” dialog box, I get dumped to a ‘page cannot be displayed’ screen but if I click Back, then the page renders fine and plays the video. Go figure! Might even be a bug in that particular version of the Flash player (8?) because the same page just kills Konqueror on Linux; shuts the browser down, but works fine in Firefox on Linux – and that’s using exactly the same Flash shared library code!

So unfortunately I don’t know why it does it. wouaren got round it somehow, he might be your best bet, but please post back here if you find an answer; this “feature” is annoying me beyond belief! Of course, if it is the plugin then I’ll fix it, but tracking down the exact circumstances it happens is the key. Sorry I can’t be any more help right now.


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

#314 2007-11-06 10:18:18

vittorio
Member
From: Roma caput mundi
Registered: 2006-02-01
Posts: 122
Website

Re: smd_slimbox

Bloke wrote:

Alternatively, try removing (hiding) the article that contains the embedded youtube video, and reloading the page. Does the problem go away then? wouaren had a similar issue waaay back on page 1 or 2 of this thread and I think the outcome was that mootools or slimbox.js just plain didn’t agree with the <embed> tag in Internet Explorer. Kind of ironic given that the only reason to use the embed tag is to please Internet Explorer’s broken <object> tag :-p

It seems to be exactly that, not the swfobject . Moving the <script src="swfobject.js"> somewhere else in the page, didn’t seem to solve anything. Now, with that script hidden, the error shows up on every page containing an embed or object tag. Look: main page is working now (on IE), while a post with a youtube video is not.

Follow up: I turned on kml_flashembed and the swfobject script, and get the error on a page with a flash movie too.

Anyway, I’ll email I’ve already emailed wouaren, asking what he did to fix this thing, and will keep you informed.

Cheers,
Vittorio

Last edited by vittorio (2007-11-06 10:36:14)


Happily served with Txp: Strampelli.net, Brain Essence, NicolaTranfaglia.com

Offline

#315 2007-11-06 10:51:16

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

Re: smd_slimbox

vittorio wrote:

I turned on kml_flashembed and the swfobject script, and get the error on a page with a flash movie too.

Freaky! So it happens with pure flash too. How very bizarre. Yet on this site where I’ve used an embedded object tag, both mootools and slimbox are loaded (though not used) and it plays fine in IE (btw, I know there’s a js error I haven’t located yet).

Clearly something is different between your page and mine that’s causing the conflict. I guess all we (you :-) can do for now is keep prodding at it, maybe with wouaren’s help, commenting stuff out and trying to figure exactly what combination of scripts/filters/plugins makes IE cry.

will keep you informed.

Many thanks. I’m just trying to add simple swfobject.js support into smd_random_banner (nowhere near as glorified as kml_flashembed, but enough so simple random movies can be played back using the library if you wish).

As I test that I may stumble across something.

Edit: Just chatted to wouaren. He suggested looking at this site which details the exact problem and suggests a workaround. In case the site ever goes down, I quote:

The problem is you can’t append to the body element from script that isn’t a direct child to the body element. It can be fixed simply by putting defer=”defer” in the script tag. According to the W3C, the defer attribute “… provides a hint to the user agent that the script is not going to generate any document content (e.g., no ‘document.write’ in javascript) and thus, the user agent can continue parsing and rendering” … The fix, as stated in Eoghan’s post, was to put defer=“defer” in the script tags whenever I was using SWFObject.

Maybe try that? And if it works, we both owe wouaren a pint :-)

Last edited by Bloke (2007-11-06 11:04:48)


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

  1. Index
  2. » Plugin support
  3. » smd_slimbox

Board footer

Powered by FluxBB