Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
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.
Offline
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.
Hire Txp Builders – finely-crafted code, design and Txp
Offline
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)
Offline
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.
Hire Txp Builders – finely-crafted code, design and Txp
Offline
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
Re: Theme prefs plugin
etc wrote #291349:
That’s more or less what
etc_variablesdoes
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.
Hire Txp Builders – finely-crafted code, design and Txp
Offline
Re: Theme prefs plugin
Bloke wrote #291348:
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?
What I want is to make it really simple (for everybody) to install templates. That’s it. After that, if an admin who know what is doing want to change anything, he is the boss…
Offline
Re: Theme prefs plugin
NicolasGraph wrote #291351:
What I want is to make it really simple (for everybody) to install templates.
Right, ok. So, by ‘Templates’ you mean Pages & Forms? Are you using rah_flat or something like that to design them outside Txp? In which case, having some way to define the prefs that will then appear in the Preferences panel for editing values makes sense. Sort of.
The problem will be that if you rename one or delete one from the template, it’ll still be there in the prefs panel. So then you need to have the notion of a <txp:oui_prefs_delete> tag too? Which you only run once, then have to go and delete from your template. And if you have all the prefs defined in a Form, for example, using this plugin’s fictional ‘add’ tag, you need to include that Form in your design somehow with a <txp:output_form /> tag in order to make it do anything. That adds processing time / weight to your Pages and is also unnecessary: after all, once the vars are set, you don’t need to keep adding them every page load. You only need them to be read back from prefs.
Seems like we’re approaching this in the wrong way, which is why I wondered if having the vars defined in a sort of ini file that the plugin reads (only when visiting the admin side) you could then:
- Manage the available vars externally (not sure about deletions / alterations: ideas welcome).
- Not have to worry about difficulties upgrading the plugin in future.
- Give users the ability to edit the pref values from the UI, and control access rights based on their login type.
- Not have to add any unnecessary tags to your templates.
But it all depends on your workflow and what’s easiest for you. etc_variables sounds like a good fit.
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
Re: Theme prefs plugin
Bloke wrote #291352:
Right, ok. So, by ‘Templates’ you mean Pages & Forms? Are you using rah_flat or something like that to design them outside Txp? In which case, having some way to define the prefs that will then appear in the Preferences panel for editing values makes sense. Sort of.
Yes that’s what I try to achieve. See my first post:
NicolasGraph wrote #291290:
Hi,
I’m trying to set a plugin to easily manage themes prefs from the Txp advanced prefs page.
I used to use adi_variables in the past, but I’m playing with rah_flat now, which is not compatible with.
As Jukka suggested in this Github post I’m trying to add the prefs managed with adi_variables though new prefs fields.
In fact I’m looking for something like a new adi_variables to use with rah_flat but, on my side, I don’t need (maybe other Txp users need it) a user interface to define the prefs / variables names; I only need it for values.
Bloke wrote #291352:
The problem will be that if you rename one or delete one from the template, it’ll still be there in the prefs panel. So then you need to have the notion of a
<txp:oui_prefs_delete>tag too? Which you only run once, then have to go and delete from your template. And if you have all the prefs defined in a Form, for example, using this plugin’s fictional ‘add’ tag, you need to include that Form in your design somehow with a<txp:output_form />tag in order to make it do anything. That adds processing time / weight to your Pages and is also unnecessary: after all, once the vars are set, you don’t need to keep adding them every page load. You only need them to be read back from prefs.Seems like we’re approaching this in the wrong way, which is why I wondered if having the vars defined in a sort of ini file that the plugin reads (only when visiting the admin side) you could then:
- Manage the available vars externally (not sure about deletions / alterations: ideas welcome).
- Not have to worry about difficulties upgrading the plugin in future.
- Give users the ability to edit the pref values from the UI, and control access rights based on their login type.
- Not have to add any unnecessary tags to your templates.
But it all depends on your workflow and what’s easiest for you. etc_variables sounds like a good fit.
Ok, I understand. Plugin dev is a real job…
etc_variables looks fine but, if I understand well, I can’t embed the prefs needed to make my templates work. They have to be created by the admin, right?
Last edited by NicolasGraph (2015-06-05 13:28:53)
Offline
Re: Theme prefs plugin
NicolasGraph wrote #291353:
I don’t need a user interface to define the prefs / variables names; I only need it for values.
Makes perfect sense if working with rah_flat. There’ll be a solution somehow. Willing to accept ideas from anyone at this stage on the best approach.
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
Re: Theme prefs plugin
Could it become a part of rah_flat?
Could it be possible to add prefs like sections? It would be perfect but I really don’t know if it’s possible and how…
Edited to add the link
Last edited by NicolasGraph (2015-06-05 13:49:04)
Offline
Re: Theme prefs plugin
NicolasGraph wrote #291355:
Could it be possible to add prefs like sections?
Sure, that’s easy. JSON is a good choice as it’s fairly readable and easy to parse. Just got to decide where the file should live in the directory structure. Suppose a pref would be the way to go, with some sensible default.
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
Re: Theme prefs plugin
Wow, things have moved fast here and a few plugins have come up that I haven’t seen before. Must read more carefully later, but …
Regarding setting prefs in your own flat files, did you see that rah_flat already supports that? As far as I can tell (not having tried it), it prefixes its prefs with rah_flat… so won’t bork other prefs (but try it first!!).
I don’t think rah_flat downloads anything at all from the db into flat files, so it won’t respect changes you make via the admin panel (if you are indeed allowed to). That also kind of goes against the idea of managing things via flat files and was the root of the problem with adi_variables.
Thinking aloud (but hazy, coz it’s 30° here on a Friday afternoon), the other way you might be able to set up your prefs once and then allow them to be user-editable is to either use a small setup script for your site, that you then switch off (I do that to quickly update prefs for local, staging and live dbs), or use a plugin by net carver, the name of which I forget, which allows you to set up a start configuration.
TXP Builders – finely-crafted code, design and txp
Offline
#44 2015-06-05 15:48:00
- uli
- Moderator

- From: Cologne
- Registered: 2006-08-15
- Posts: 4,316
Re: Theme prefs plugin
jakob wrote #291359:
[…] or use a plugin by net carver, the name of which I forget, which allows you to set up a start configuration.
Was it sed_cleaner?
In bad weather I never leave home without wet_plugout, smd_where_used and adi_form_links
Offline
Offline