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: 10,263
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.

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: 10,263
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.

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: 10,263
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.

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: 10,263
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.

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: 10,263
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.

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

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

Board footer

Powered by FluxBB