Textpattern CMS support forum

You are not logged in. Register | Login | Help

#21 2015-06-05 10:25:47

Bloke
Developer
From: Leeds, UK
Registered: 2006-01-29
Posts: 8,785
Website

Re: Theme prefs plugin

Bloke wrote #291333:

I’ll fix that later for you.

Actually it was too simple not to do now:

# Name: oui_prefs v0.10 (compressed)
# Type: Admin 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:
# .....................................................................

H4sIAAAAAAAAA91Y7XPbNBj/3r9CZwpOipc2bbcxh8B60I3CKL0x4Liy8ym2nIg5kpHkdLnd
/ncePZITx3bX3oAv+EPrWI+e19/zItF4PI7f6fg0DgRdsmCi4ydxICuelIrl2v5+FAe0Mgup
7I/xcRxc8lQWVD9XtFzgt6OaIqkUt1/gg/33OA5WTGkuhf0FIo5G4yPcMY6DjOlU8dL4VZD6
MzNkIxWoU5mhQg8fnQLDw4ODPXJAfqRckBTEa5JLRWi25OKB5hkjeSVSy40W3KxHQHu45+g2
1uy92yPwICf7HJCropoDP7ZiwhDrAE2oyEALvtIjT1TTfrOgYs6IWXBNjCRLatIFWctKES4M
ExnLnPZkrmRVNrgVXBsic+TqF1e0qFhHwtMVBYuUomv/5RD/l0oalhrgv1+Cvueo7NQRDhwl
POHGzJBMvyLhODqOTsII14eTvVsstxtQwQ9Zi5KszRoiBNqj0ShqRH4SjIA+ak1K5j6CO9w2
iA84Ka454iJTTKQssc6xWjZtOHB2ZCynVWESdFEEH67xDVhSQ4ArF5op64zZuqZ9vcMAgxmR
7XNtFmwnNGDJzYJD9FDNGSukmIMpv8uKpFSgldxojKAzhpFX7K0pafqG0JlcsV2BlnWy4prP
uIVeRK4rXdGiWJOrl+fPkrNvfz27/Ob8W8Tr6ejh6C2BF1y6evHL84tLv/Do8xG5hEjHREjy
VwVvelcOF2VlkhuezZmz79qAVgl+jsiaaSEVzbiMiBQyz/G9panU3KbIxjv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MLrWdqqUZqynYAzvWWA2edIqK50cqQdQmyJ4
KLMJ4st0O0Vs/4V5B0UMkDryLfhDzVjXO/rTDdn0L3k1rv1s9/ouMjfi3UnWGPDupPUT3p10
m/nuTsrGnPe6Q9qZDXbfuin+ki3hyHJXhn94+uutrz1TYL0hYW8BMTDpKBSOe8NhO/SHh/bg
Q86uLv7lKbAhdeAGhboS3+o8wuxx8t2/rEinwtdTUoBAnGJ5r5tIraOt850yf3ecnzGD1xCs
eZHlIl5SwWx9FJ06d2FCTfzFGgCjtHdPtq6CgRCa0REox7QIDVlQjyGoVYiIvGZxlq0olLSM
XOGYdss5tgdKVp8OiuaFnMEhfz+bea0aXdwizH+F08gSeg2MRxtCaLqg8oOMreDQ8SU56pw8
rDzo2eHXzveoxGd2IptSb4IPz+S/hgUA/0xrPhfuSsRddblu5W6VgJH1tRTMXhf8WS3tRdPo
PrNXaxToNfoT538UlTSOH81xYfOqmKlggEVGk1ug971TsFFjEHH3rSm+8HWwUCvfGfIcchrI
WDAKrXcQvpApdtuYoFmWblgrDWoLdrMVCwz85bBZl3g5PI6DE7wkjgO8y/LfHvpveUHnukkH
WxesKIPJLD6CnydxsMyQ+OQ4Dk5P8ocsOz0+TSkdH89O0sen7MmTdPzF4+NHKZ09Dibv/wZ+
9HBgMRcAAA==

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

#22 2015-06-05 10:26:00

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

Re: Theme prefs plugin

Bloke wrote #291333:

The plugin only cleans up prefs it knows about on deletion, i.e. those that are defined in the $plugEvent variable. If you want to clean up your older prefs, you’ll need to do this…

In fact I talked about the prefs included in the plugin code above: pref_name1 and pref_name2.


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

Offline

#23 2015-06-05 10:27:34

Bloke
Developer
From: Leeds, UK
Registered: 2006-01-29
Posts: 8,785
Website

Re: Theme prefs plugin

NicolasGraph wrote #291335:

In fact I talked about the prefs included in the plugin code above: pref_name1 and pref_name2.

They’re defined under the oui_prefs event so as long as that is in $plugEvent, they’ll be deleted. Try installing the version of the plugin I just posted and disable it. The prefs should disappear.


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

#24 2015-06-05 10:30:46

Bloke
Developer
From: Leeds, UK
Registered: 2006-01-29
Posts: 8,785
Website

Re: Theme prefs plugin

NicolasGraph wrote #291332:

I can’t see where values are passed into variables in the code.

They’re not (yet). That requires a public callback to read the pref values. Very simple, should only be a few lines of code.


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

#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: 8,785
Website

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:
# .....................................................................

H4sIAAAAAAAAA91ZbX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2+A2Dk
5g2X6avgIKRmNAbjmBK+JivqMAS9ChGRViqukg2FlpaQOySDB27LPVAy9nRQtMzkgmbkNFk4
qxpT3CDMrcKdZw2zBghQLQhDF0x+kbANsMm/kXHnfmPOg5nt/93GHo34i+Fcc+pccOlpM9c/
HBYA/Cul+FLYFy/2hZqdVvbdFSgysZaCmZcSP5dr8zpr9Bzu1aICvU7/ycYfj4oal5wmXai/
Ap0ugaKiossD0PunNbDRYxBxz+0prvF1sFAZ3yF5FjkNZKwYhdE78N/IGKdtSNAtIzc8ZPQd
2mPLpB7w4ATENGl4Yl/i4rWc2pzBs7URhCsHNwy3jfknJm59VTmI+0ppw7nPwxtOT/Oyc267
USEfoS8LvNOCb4ardhuTQcyTrelAQVRnVVShD/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: 8,785
Website

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: 3,346
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.

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

Board footer

Powered by FluxBB