Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#13 2009-02-02 20:34:50

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

Re: smd_style: present alternate stylesheets with a style switcher

johnno wrote:

validator.w3.org detect errors (five to be precise) such as

Hmmm, that’s entirely possible. I think it may depend on where you put the call to <txp:smd_styleswitch />. If you put it in the <head> it is not supposed to complain. Emphasis on supposed :-)

If you put the smd_styleswitch in your head, use wraptag="" and then put your own <div> (or whatever) element in your markup where you want the switcher to appear and give the plugin the class name of thae target. That should cure it.

If it doesn’t, never fear. As luck would have it I’ve found a few other flaws in the plugin and I’ve been working on it today. I’ve fixed a few jQuery issues so it works with v1.3 of the library, added an html_id attribute, and enhanced the switching ability so you can define your own switcher layout via a form. I’ve also allowed content switching by class name so you can tell each switcher to add/remove a particular style on any element when you click a link/check a box/select a value from a dropdown/whatever.

Should be out in the next few days once I’ve tested it to within an inch of its life.

Last edited by Bloke (2009-02-02 20:36:53)


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

#14 2009-02-02 21:57:39

johnno
Member
Registered: 2007-06-14
Posts: 30

Re: smd_style: present alternate stylesheets with a style switcher

Errors generated whether in body or head…sorry.
New improved model eagerly awaited! Tnx

Offline

#15 2009-02-02 22:18:30

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

Re: smd_style: present alternate stylesheets with a style switcher

johnno wrote:

Errors generated whether in body or head…sorry.
New improved model eagerly awaited! Tnx

OK, thanks for the report. I’ll try and remember to check the output in the validator on each test, as I run the new version through its paces.

Last edited by Bloke (2009-02-02 22:19:13)


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

#16 2010-05-17 02:15:47

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

Re: smd_style: present alternate stylesheets with a style switcher

Stef,

Love this plugin, but can’t seem to make it work…

I have this in the head:

<txp:smd_style sheets="hide,display" />
<txp:smd_styleswitch wraptag="" />

And this in the body:
<ul class="smd_switcher"></ul>

There is also a link to jquery (v1.3.2) in the head

But <ul class="smd_switcher"></ul> gives nothing. No list…

I am using PHP5 and Textpattern · 4.2.0.

Any ideas?


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

#17 2010-05-17 08:16:18

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

Re: smd_style: present alternate stylesheets with a style switcher

Kjeld wrote:

Love this plugin, but can’t seem to make it work…

Ah, yeah. There’s a small issue with the plugin under jQuery 1.3+. Essentially I was a bit of a tool when I wrote it and used the deprecated ‘@’ syntax in my selectors.

Bottom line: you should be able to fix the plugin by searching for ‘@’ symbols in the code on lines that start with jQuery and removing them. There are only 2 lines you need to change (lines 182 and 222); there are only 4 symbols you need to remove in total.

That should get you going. Failing that, I do have a new version written that I could let you have which is a bit tidier and adds some neat features for class-level (CSS) switching. Last time I checked there was one tiny bug that has thus far prevented me from releasing it publicly but if you’re not using class switching it’ll work fine. Drop me an e-mail if you’d like the new version (btw, my e-mail address has changed, so please use the forum e-mail link or my site’s contact form).

Hope that helps.

Last edited by Bloke (2010-05-17 08:16:41)


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

#18 2010-05-18 08:26:06

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

Re: smd_style: present alternate stylesheets with a style switcher

Thanks, Stef. Removing the ‘@’ symbols didn’t fix the problem, I am afraid. I will send you a message.

Last edited by Kjeld (2010-05-18 08:28:08)


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

#19 2010-10-19 15:10:53

lazyadmin
Member
From: Germany
Registered: 2009-08-08
Posts: 25
Website

Re: smd_style: present alternate stylesheets with a style switcher

Any news when the new version will be released?

Offline

Board footer

Powered by FluxBB