Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
#31 2007-12-31 20:27:11
- rsilletti
- Moderator

- From: Spokane WA
- Registered: 2004-04-28
- Posts: 707
Re: Converting a plugin to jQuery
Are you sure you don’t have those reversed? One is inserted with jQuery(rollover_text) and is applied as text to the text node, the other(default_text) is assembled by the php and returned as html by the function. Again, I could be wrong, javascript isn’t my strength.
Offline
Re: Converting a plugin to jQuery
Hi Rick. Here is what I have:
<txp:ras_rollover_src source_image="206" source_url="/link" rollover_text="<h4>Test H4</h4>This text edited for brevity." html_id="text" />
<txp:ras_rollover_dest class="height150" default_text="<h4>Test1</h4>This is some text." /></div>
In the Head of the document:
<txp:ras_rollover_js default_text="<h4>Test2</h4>and some more text..."/>
The txp:ras_rollover_dest text displays fine. The txp:ras_rollover_js displays under what will be the text displayed (txp:ras_rollover_dest) when hovering over the images. All the txp:ras_rollover_js is quite large, but I guess it could be because its an H4 tag within a P tag. Still, I could get past that if I could get the txp:ras_rollover_js text to display in the same place as the rest.
The problem goes away when I remove the txp:ras_rollover_js H4 tags.
FYI!
Offline
#33 2007-12-31 21:58:44
- rsilletti
- Moderator

- From: Spokane WA
- Registered: 2004-04-28
- Posts: 707
Re: Converting a plugin to jQuery
Have you tried using the wraptag attributes to remove the undesirable p tags ? ( wraptag=’‘ ), both the src and dest tags have that choice available. You can always wrap the whole TXP tag if you need to.
Last edited by rsilletti (2007-12-31 21:59:43)
Offline
Re: Converting a plugin to jQuery
Hi Rick,
ras_rollover_js has one attribute – default_text – according to your plugin help. I tried adding a wraptag attribute but I saw a TXP tag error for the wraptag.
Issue for me is the ras_rollover_dest tag. The image rollovers are fine. (I have 6 images with rollovers).
If I add an H4 tag into the ras_rollover_dest, the ras_rollover_dest text always displays under the ras_rollover_src text.
Seems to me that when an H4 is entered like so: “ras_rollover_dest default_text=”<h4>Test</h4>Bla bla…”, the #ras_rollover is not applied. When I remove the H4 from the default_text, the #ras_rollover is applied, so the text show up in the right place.
Hope this is explained well…..
Offline
#35 2008-01-01 17:20:08
- rsilletti
- Moderator

- From: Spokane WA
- Registered: 2004-04-28
- Posts: 707
Re: Converting a plugin to jQuery
The js tag doesn’t have a wraptag attribute, it doesn’t output html it renders the javascript script. The src and dest tags do.
If I had to guess I would say that TXP is closing the tag at the end of the first h4 closure as per the parser’s function, that drops out the rest of the tag info and disables the tag. You might try asy_wondertag to get around that, but my recommendation, and I would pass this on to your clients to avoid any inconvenience, would be to stick with straight text when passed as attributes.
When I was first developing this I tried passing image tags into the DOM without much success and settled for the text approach for the plugin and added what follows to the help file to suggest better options inline. Things get far to complicated trying to make everything work from within the plugin itself.
Excerpt from the help file
The choice of using html tags in your templates (if you want to rollover heading tags for instance) can be accomplished by using<br />
“ras_rollover_src” as the class, the “alt” attribute for your rollover text, and an html id of “ras_rollover_dest” for your destination element<br />
This can provide finer control and more options in some cases.
Offline
Re: Converting a plugin to jQuery
Offline
#37 2008-01-07 02:29:10
- rsilletti
- Moderator

- From: Spokane WA
- Registered: 2004-04-28
- Posts: 707
Re: Converting a plugin to jQuery
First issue would be the inappropriate usage of the alt attribute, that is internal to the plugin and I have a fix available here: plugin 4.0.5.3
This variation changes the alt usage to a name attribute which is used with an anchor tag. The migration of the alt attribute had to do with the original image use for this as a replacement for the title attribute which duplicated the visual aspect. It is a simple change and it works as it should for me – testing is however thin for the change.
HTML ids are intended to be discreet in a page, each source tag should be applied with its own id.
I don’t think I can help you with the validator errors on the inserted h4 tags.
Last edited by rsilletti (2008-01-07 02:30:08)
Offline
Re: Converting a plugin to jQuery
Hi Rick, is the updated plugin compatible with Mootools? Second question – does your plugin have to use the JQuery library? Or can the code stand alone?
Offline
#39 2008-01-07 15:20:40
- rsilletti
- Moderator

- From: Spokane WA
- Registered: 2004-04-28
- Posts: 707
Re: Converting a plugin to jQuery
It should be independent of any clashes with mootools, I don’t know about compatabilty because I have never used mootools..
Yes, it does require jQuery.
Offline
Re: Converting a plugin to jQuery
Thanks. Question: Is it possible to get your images to link to a lightbox? (Slimbox actually)
Offline
#41 2008-01-07 23:28:55
- rsilletti
- Moderator

- From: Spokane WA
- Registered: 2004-04-28
- Posts: 707
Re: Converting a plugin to jQuery
I don’t know how Slimbox works or what it does. The anchor link around the images takes an href attributes if that will accomplish what you are looking for?
Offline
Re: Converting a plugin to jQuery
rsilletti wrote:
I don’t know how Slimbox works or what it does.
It needs rel="lightbox-somevalue" added to each anchor. Then mootools/slimbox does the rest.
‘somevalue’ should be user-defined if possible to allow for multiple separate galleries per page.
Last edited by Bloke (2008-01-07 23:42:27)
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
#43 2008-01-07 23:54:18
- rsilletti
- Moderator

- From: Spokane WA
- Registered: 2004-04-28
- Posts: 707
Re: Converting a plugin to jQuery
Manually coding your source links would make that workable. Creating the choice for user input would be more complex and might be best done with php unless your choice would be inputing as part of the template from the admin side, the source tag could be tailored to do that.
Offline
Re: Converting a plugin to jQuery
rsilletti wrote:
Creating the choice for user input would be more complex and might be best done with php unless your choice would be inputing as part of the template from the admin side, the source tag could be tailored to do that.
Oops, sorry I wasn’t clear. I meant the 2nd one; the site author should have control via an option in the plugin if at all possible to supply “somevalue”.
But hard-coding it or having the author supply their own anchor tags + rel attributes works equally well; they just have to be aware that if there are multiple rollovers on a page, when lightbox is launched the Next/Prev links will cycle through all rollover pics on that page. Using a unique ‘somevalue’ for each “group” of pictures allows the Next/Prev to only iterate within the selected group.
In essence, as long as the “lightbox-” bit appears in the rel tag, it works. Oh, and if a class can be supplied to the anchors too, then if it’s set to class="Thickbox", that lightbox system can be used instead.
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
#45 2008-01-08 02:32:51
- rsilletti
- Moderator

- From: Spokane WA
- Registered: 2004-04-28
- Posts: 707
Re: Converting a plugin to jQuery
Hmmm… too many classes. Having a common class for the source tags is intregal to the operation of the script.
Offline