Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
Pages: 1
variable types
I’m finding the <txp:variable />
and related tags extremely useful just at the moment but I was wondering if they could be more flexible by maybe having a “type” or “format” attribute or something similar that would allow us to be able to set a variable as either a “field”, “select”, “radio” or “checkbox”.
Would that be possible and would it be a useful improvement? Would be for me but would others find it useful?
Stuart
In a Time of Universal Deceit
Telling the Truth is Revolutionary.
Offline
Re: variable types
Why would you find this useful, for a start?
Offline
Re: variable types
Which is why I asked because my use for this might be a little unique, at least at the moment, until my methods catch on. ;)
In my ports of WP themes I am using 2 highly modified versions of Adi’s adi_variables
plugin to create 2 new tabs within “Content”. Each tab, one for theme variables and one for widget variables, has a list of variables whose values can be easily modified by the user to individualise the theme for his or her use. Saves them having to dive into the code and find all the appropriate tags and attributes.
I would definitely find a “select” type very handy but if we can do one type why not go the whole hog?
Last edited by thebombsite (2010-05-16 15:33:16)
Stuart
In a Time of Universal Deceit
Telling the Truth is Revolutionary.
Offline
Re: variable types
For me it seems like you are looking for private “preferences” which are feasible within Textpattern’s current feature set. These already support all kinds of input methods (yes/no/don’t-know-i-am-the-manager, selects, text) and are expandable to input methods not contained in core.
Offline
Re: variable types
Hi Stuart,
If you are try to generate a list of radios/checkbox/options, combination of txp:variable
and smd_each
may be enough.
You can use smd_each
to iterate over a simple txp:variable
which value is just a list of comma-separated (or any other delimiter) strings.
Edit: Oops. My reply above is related to the first two post, when I didn’t know this was something “server-side” related.
Last edited by maniqui (2010-05-16 16:17:13)
Offline
Re: variable types
Thanks for that info Julián. Might come in handy.
@Robert – So that’s a no then? But let me just get this straight. You are suggesting that, rather than use my current method of exploiting the <txp:variable />
tag, I should look at a plugin that adds variables in a similar fashion to the “Preferences” tabs?
Last edited by thebombsite (2010-05-16 23:09:28)
Stuart
In a Time of Universal Deceit
Telling the Truth is Revolutionary.
Offline
Re: variable types
thebombsite wrote:
@Robert – So that’s a no then? But let me just get this straight. You are suggesting that, rather than use my current method of exploiting the
<txp:variable />
tag, I should look at a plugin that adds variables in a similar fashion to the “Preferences” tabs?
TXP’s preference panel can be easily extended with new set of settings. There is IMO no reason to add same deal for variables that are just set of tags. If you love variables you can populate variables according the info defined in prefrences with the help of some plugin.
Only thing you need is, some snippet (packaged inside plugin or modified/extended mem_templates etc) that allows you to create the preferecence fields during the plugin setup, and/or, theme setup. Creating a settings field involves calling one function.
…Or you can always mod adi_variables to allow different field types in a way or another.
Last edited by Gocom (2010-05-16 23:50:29)
Offline
Re: variable types
Thanks Jukka. I did think about going that extra step with modifying adi_variables but it didn’t happen. I like Robert’s idea, assuming that is what he meant. For one thing I can create a much better page layout and could get away with a single plugin that produces 2 sub-tabs and no forms. Now I haven’t created a plugin from scratch before so this might take a little while m’kay? ;)
Stuart
In a Time of Universal Deceit
Telling the Truth is Revolutionary.
Offline
Re: variable types
thebombsite wrote:
@Robert – So that’s a no then? But let me just get this straight. You are suggesting that, rather than use my current method of exploiting the
<txp:variable />
tag, I should look at a plugin that adds variables in a similar fashion to the “Preferences” tabs?
Right. Plus you’d need a (yet inexistant ) plugin which either transfers preference settings into variables, or alternatively provides a set of new tags to access preference values and some accompanying conditionals.
Offline
Pages: 1