Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
Pages: 1
#1 2008-05-16 14:47:45
- Ruhh
- Member
- From: dakota dunes
- Registered: 2008-01-20
- Posts: 305
[request] theme switcher?
Is there a plugin available or could there be a plugin created for a theme switcher? It is where a visitor can choose the theme he/she wants to view the site in. I do not know if it is possible or not. But I thought it would only take for a theme to have two output forms, one acting like header.php and the other acting like footer.php.
<txp:Ruhh />
Offline
Re: [request] theme switcher?
Ruhh wrote:
Is there a plugin available or could there be a plugin created for a theme switcher?
There is one: fla_style_switcher / fla_altlist_link but I have always struggled to make it work exactly how I want (however, that’s more than likely because I’m a bit thick).
I have started work on an update based on jQuery but it’s not ready for prime time yet, sorry.
Last edited by Bloke (2008-05-16 14:54:51)
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
Online
#3 2008-05-16 14:57:01
- Ruhh
- Member
- From: dakota dunes
- Registered: 2008-01-20
- Posts: 305
Re: [request] theme switcher?
I have seen that before. But it’s a stylesheet switcher. Could there be a template switcher? I have a graphic header in the page template rather than in the stylesheet.
<txp:Ruhh />
Offline
Re: [request] theme switcher?
Ruhh wrote:
Could there be a template switcher? I have a graphic header in the page template rather than in the stylesheet.
Ah, in that case I don’t know of one.
I’d be tempted to move the graphic to the stylesheet as a background: url(/images/nn.jpg) no-repeat;
but it does seem a bit hacky.
EDIT: or put the style line above as an inline style in your page template? Not sure if that would work as you expect. Scrap that, I’m talking nonsense.
Last edited by Bloke (2008-05-16 15:03:25)
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
Online
#5 2008-05-16 15:03:05
- Ruhh
- Member
- From: dakota dunes
- Registered: 2008-01-20
- Posts: 305
Re: [request] theme switcher?
That wouldn’t work because the graphic header is inside the div with a class and that class already have a background different from the graphic header.
<txp:Ruhh />
Offline
Re: [request] theme switcher?
Ruhh wrote:
That wouldn’t work because the graphic header is inside the div with a class and that class already have a background different from the graphic header.
In that case, cheat and use smd_if or some other conditional plugin :-)
Essentially, make links to the same page but add a ?theme=theme1
/ ?theme=theme2
to the links, then use smd_if (or equivalent) to detect the theme
variable and output the header1 or header2 form.
Last edited by Bloke (2008-05-16 15:08:35)
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
Online
#7 2008-05-16 15:19:06
- Ruhh
- Member
- From: dakota dunes
- Registered: 2008-01-20
- Posts: 305
Re: [request] theme switcher?
So let me get this clear…
I put two different output forms inside those smd_if tags and provide links with the ending, ?theme=theme1/theme2? Or else I will need detailed instructions on this.
<txp:Ruhh />
Offline
Re: [request] theme switcher?
Ruhh wrote:
I put two different output forms inside those smd_if tags and provide links with the ending, ?theme=theme1/theme2?
Pretty much yeah. In your page template:
<txp:smd_if field="urlvar:theme" operator="eq" value="theme1">
<txp:output_form form="header_theme1" />
</txp:smd_if>
<txp:smd_if field="urlvar:theme" operator="eq" value="theme2">
<txp:output_form form="header_theme2" />
</txp:smd_if>
and then somewhere on your page (the footer form?) where you want to offer the ability to switch themes, you’d add:
Switch themes: "Theme 1":/this-article?theme=theme1 | "Theme 2":/this-article?theme=theme1
and so on. You may be able to remove the name of the article and just use the ‘?’ bit in the link which should default to the current article/section/whatever. Or use TXP tags to generate the links to the pages and tack on the theme
bits.
The only sticking point is that you’d need to deliver some “default” theme in the absence of the theme
variable. Under the new parser scheduled for TXP 4.0.7 you could nest the smd_if tags inside their own <txp:else />
blocks but under 4.0.6 you’ll have to be clever with your else’s and/or do some other checking, I think.
Does that help? Or is that just ridiculously complicated (as usual for my so-called “solutions”!)
Last edited by Bloke (2008-05-16 15:33: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
Online
#9 2008-05-16 15:35:30
- Ruhh
- Member
- From: dakota dunes
- Registered: 2008-01-20
- Posts: 305
Re: [request] theme switcher?
Hm, I will see what I can do.
(Can’t wait for 4.0.7!)
<txp:Ruhh />
Offline
Pages: 1