Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#25 2015-06-05 10:31:34

NicolasGraph
Plugin Author
From: France
Registered: 2008-07-24
Posts: 860
Website

Re: Theme prefs plugin

Bloke wrote #291336:

Try installing the version of the plugin I just posted and disable it. The prefs should disappear.

Yes, it works very well now but the prefs are still added on install. Is it possible to add them with the enable event?

Last edited by NicolasGraph (2015-06-05 10:31:55)


Nicolas
Follow me on Twitter and GitHub!
Multiple edits are usually to correct my frenglish…

Offline

#26 2015-06-05 10:51:52

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

Re: Theme prefs plugin

NicolasGraph wrote #291338:

the prefs are still added on install. Is it possible to add them with the enable event?

D’oh of course. Sorry.

Try this version, that fixes that and also adds the prefs as variables directly to your page so you can access them immediately via <txp:variable> and <txp:if_variable>. Note that the plugin will (over)write the variables even if they already exist.

EDIT: also note the plugin type has changed to 1 (admin + public).

# Name: oui_prefs v0.10 (compressed)
# Type: Admin/Public plugin
# Set prefs
# Author: NicolasGraph
# Recommended load order: 5

# .....................................................................
# This is a plugin for Textpattern CMS - http://textpattern.com/
# To install: textpattern > admin > plugins
# Paste the following text into the 'Install plugin' box:
# .....................................................................

H4sIAAAAAAAAA91ZbXPbNhL+7l+B4fmOko+R9eKkE/rUq6d1e75LXU+a3s2Nz8OBSFBCQwEs
AcrRZPLfu1iAFEVSltv00+lDLIGLxb48u/uAoeFkEn5U4UXoCbpm3qUKX4eeLHmUFyxV5ver
0KOlXsnC/JhMQ++WxzKj6ruC5itcG1cSUVlwswIL5s8XobdhheJSmF9wxHg0GeOOSeglTMUF
z7V7Cqf+yDSpTwXpWCZo0Kvp+GXonZ+dnZAz8j3lgsRwvCKpLAhN1ly8UDxhJC1FbLTRjOvt
CGTPT6xc7c3JxxMCH9RkPmfkLiuXoI9tmNDEBEARKhKwgm/UyAlVsl+vqFgyoldcES3Jmup4
RbayLAgXmomEJdZ6sixkmTe0ZVxpIlPU6h5uaFayzglfb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AQVRnVVShD/y1i/coco+2+A8PJtF2wZj1cKz9QUIFe9xF
F/Dg/kdBb3P8H4VJ6E3M35ehhy9A3dpLt5ZmdKnc2sxtXbEs9y4X4Rh+zkJvnaDwbBp649nF
xez1ZDFl4+l4Np1evP6CwS12NpldxNPFxSvv8tOvnvAJ3WYZAAA=

Last edited by Bloke (2015-06-05 10:53:01)


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

#27 2015-06-05 11:03:33

NicolasGraph
Plugin Author
From: France
Registered: 2008-07-24
Posts: 860
Website

Re: Theme prefs plugin

Bloke wrote #291339:

this version…

Just perfect enough for me now… Thanks Stef! :-)

I suggest you to be credited as the author because even what I did at first was made from your code. And I’m not sure I could maintain the last code by my own.


Nicolas
Follow me on Twitter and GitHub!
Multiple edits are usually to correct my frenglish…

Offline

#28 2015-06-05 11:09:54

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

Re: Theme prefs plugin

NicolasGraph wrote #291340:

Just perfect enough for me now… Thanks Stef! :-)

No worries, glad it helps. I may make it an official plugin and put it under my wing. Will see what jakob says first. He might find some fault / improvements yet.

I’m not happy that you need to edit the plugin to put the variables in. Might be better to define them in a separate file somehow. Ideas on best approach welcome.


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

#29 2015-06-05 11:20:29

NicolasGraph
Plugin Author
From: France
Registered: 2008-07-24
Posts: 860
Website

Re: Theme prefs plugin

Bloke wrote #291341:

I’m not happy that you need to edit the plugin to put the variables in. Might be better to define them in a separate file somehow. Ideas on best approach welcome.

A simple way to define the variables could be to use a tag like so <txp:oui_prefs name="pref_name" default="A default value" event="… /> for each pref to add (?)


Nicolas
Follow me on Twitter and GitHub!
Multiple edits are usually to correct my frenglish…

Offline

#30 2015-06-05 11:33:26

etc
Developer
Registered: 2010-11-11
Posts: 5,028
Website GitHub

Re: Theme prefs plugin

Bloke wrote #291341:

I’m not happy that you need to edit the plugin to put the variables in. Might be better to define them in a separate file somehow. Ideas on best approach welcome.

Hi guys, I don’t remember where things are now, but etc_variables had an interface for prefs creation/management. Not sure it’s working in 4.6, though.

Edit: no, it was only for managing existing variables, forget it.

Last edited by etc (2015-06-05 11:36:16)

Offline

#31 2015-06-05 11:41:08

NicolasGraph
Plugin Author
From: France
Registered: 2008-07-24
Posts: 860
Website

Re: Theme prefs plugin

etc wrote #291343:

Hi guys, I don’t remember where things are now, but etc_variables had an interface for prefs creation/management. Not sure it’s working in 4.6, though.

For me the thing is that I would like to define the prefs in my templates, without any user interface. A user could install the templates himself and the prefs would be already defined.


Nicolas
Follow me on Twitter and GitHub!
Multiple edits are usually to correct my frenglish…

Offline

#32 2015-06-05 11:41:25

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

Re: Theme prefs plugin

NicolasGraph wrote #291342:

A simple way to define the variables could be to use a tag

If you’re doing that, wouldn’t it be better to just define the ones you need in a Form stuffed full of <txp:variable> tags directly in? Or have I missed the point?


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

#33 2015-06-05 11:47:19

NicolasGraph
Plugin Author
From: France
Registered: 2008-07-24
Posts: 860
Website

Re: Theme prefs plugin

Bloke wrote #291346:

If you’re doing that, wouldn’t it be better to just define the ones you need in a Form stuffed full of <txp:variable> tags directly in? Or have I missed the point?

I don’t want the users to define the prefs, but I want them to change their values easily via the Txp interface.

Edit: oh, yes I mixed variables and prefs in my previous post… sorry Stef.

Last edited by NicolasGraph (2015-06-05 11:48:46)


Nicolas
Follow me on Twitter and GitHub!
Multiple edits are usually to correct my frenglish…

Offline

#34 2015-06-05 11:52:32

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

Re: Theme prefs plugin

NicolasGraph wrote #291347:

I don’t want the users to define the prefs, but I want them to change their values easily via the Txp interface.

Are we talking about non-admin users here? i.e. not Designers, but Staff Writers? Because anyone else has access to the Presentation panels anyway so they can alter any tags you may have set up — either via <txp:variable> or a (currently fictional) tag for setting prefs in this plugin?

EDIT: Taking a step back, what problem are we trying to address here?


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

#35 2015-06-05 11:55:08

etc
Developer
Registered: 2010-11-11
Posts: 5,028
Website GitHub

Re: Theme prefs plugin

NicolasGraph wrote #291347:

I don’t want the users to define the prefs, but I want them to change their values easily via the Txp interface.

That’s more or less what etc_variables does. Admins can parametrize the prefs (input type, option values, …), and other users only change their values.

Offline

#36 2015-06-05 11:56:34

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

Re: Theme prefs plugin

etc wrote #291349:

That’s more or less what etc_variables does

And smd_vars too (sort of, though it was never officially released afair). This feels a bit like reinventing sliced bread, which is why I’m curious what the end goal is and why existing solutions don’t suffice.


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

Board footer

Powered by FluxBB