Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
Re: smd_macro: Create custom virtual Txp tags that do stuff
mrdale wrote:
Can you imagine the havok a pixel pusher like me could cause with this bad boy?
Hehe, that’s the idea.
if you can include macros in macros…
Never tried it but I don’t see why not. They’re all loaded before your page begins rendering and you can do anything with macros that you can do with regular tags (in tags (in tags (in tags…))). The only restriction is that you can’t use them as conditional containers: they’re strictly single tags so if you want to do that kind of stuff you’ll need to either use smd_if or assign the output of the macro to a txp:variable and then use txp:if_variable to do the logic part.
EDIT: one day I might build in the ability to make conditional macros but it’s probably not worth the headache.
Last edited by Bloke (2011-03-17 15:36:49)
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
#14 2011-03-18 00:25:10
- redbot
- Plugin Author
- Registered: 2006-02-14
- Posts: 1,410
Re: smd_macro: Create custom virtual Txp tags that do stuff
Wow Bloke this is cool!
At first I overlooked it because in the description you were talking about clients so I thougth it was a textile thing (which I don’t use) but now I realize this can really speed up the development process if used in pages and forms.
I think I would have called it something like “smd_public_plugin_creator”: it’s more verbose but explains better what it can be used for.
Again: great work!
Offline
Re: smd_macro: Create custom virtual Txp tags that do stuff
redbot wrote:
in the description you were talking about clients so I thougth it was a textile thing
OK, good point. I’ll alter the description a bit to make it more generic.
“smd_public_plugin_creator”
Didn’t want to limit my market later :-) See, what I haven’t told anybody publicly yet is that this plugin blurs the line when it comes to dashboards. Install one of the dashboard plugins that allow TXP tags to be run and smd_macro comes along with them. So you could build macros for your own on-screen widgets or for simplifying repetitive content that appears on many Forms; most dashboards work on a per-priv level basis and you end up either writing a shared form and calling it with <txp:output_form />
or duplicating the content.
I haven’t fully explored this yet but I suspect you could do some pretty cool admin-side/front side interaction to help people manage their site content.
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
#16 2011-03-18 11:50:04
- redbot
- Plugin Author
- Registered: 2006-02-14
- Posts: 1,410
Re: smd_macro: Create custom virtual Txp tags that do stuff
Hey Bloke,
this is a little OT here but I begin to think smd_macro should stop being a plugin, instead it should entirely replace txp forms in the next texpattern release.
I think it could be doable rather easily while still maintaining backward compatibility with already defined txp forms.
If I’m not missing something obvious I think this proposal should be taken seriously, this move could be revolutionary as Ruud’s new tag parser.
Last edited by redbot (2011-03-18 11:50:59)
Offline
#17 2011-03-18 13:40:41
- candyman
- Member
- From: Italy
- Registered: 2006-08-08
- Posts: 684
Re: smd_macro: Create custom virtual Txp tags that do stuff
Stef thought to have arrived in India and instead discovered America ;)
Offline
#18 2011-03-18 14:02:43
- redbot
- Plugin Author
- Registered: 2006-02-14
- Posts: 1,410
Re: smd_macro: Create custom virtual Txp tags that do stuff
candyman wrote:
Stef thought to have arrived in India and instead discovered America ;)
Exactly ;-)
Offline
Re: smd_macro: Create custom virtual Txp tags that do stuff
redbot wrote:
Hey Bloke,
this is a little OT here but I begin to think smd_macro should stop being a plugin, instead it should entirely replace txp forms in the next texpattern release.
This thought crossed my mind too. Basically adding attributes to forms would make them far more useful.
Offline
#20 2011-03-20 18:16:34
- masa
- Member
- From: Asturias, Spain
- Registered: 2005-11-25
- Posts: 1,091
Re: smd_macro: Create custom virtual Txp tags that do stuff
Bloke wrote:
Ever feel awkward explaining to a client that if they want to put a few image galleries in the article Body flow that they need to type a wodge of TXP tags? Wouldn’t it be easier if you could tell them to just type in
<txp:slide_gallery category="sneakers" />
and it would render a full gallery for them?Now you can. Please welcome on stage smd_macro
Aaa-maaa-zzzing!
But that’s your middle name anyway :)
I can already hear sighs of relief.
I have one suggestion though: remembering the correct syntax of even a single line of code is still a challenge for most users.
Until now I’ve worked around the problem by saving such snippets as (cough) articles or as annotations with Adi’s note plugin. That made it a simple copy&paste job and the user only needed to alter an attribute value.
It would be great if the macros could appear as a drop-down menu in the Write tab, that would insert the code at the current cursor position.
Offline
Re: smd_macro: Create custom virtual Txp tags that do stuff
staring at monitor with mouth wide open
Brilliant. Completely brilliant.
Offline
Re: smd_macro: Create custom virtual Txp tags that do stuff
masa wrote:
It would be great if the macros could appear as a drop-down menu in the Write tab, that would insert the code at the current cursor position.
Out of curiosity, can you use upm_quicktags or something? I have a little side project that might help for article images, which I’ll reveal sometime.
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
#23 2011-03-20 18:49:10
- masa
- Member
- From: Asturias, Spain
- Registered: 2005-11-25
- Posts: 1,091
Re: smd_macro: Create custom virtual Txp tags that do stuff
Bloke wrote:
Out of curiosity, can you use upm_quicktags or something?
That sounds promising, but I can’t seem to get upm_quicktags to work under 4.3
Offline
#24 2011-03-21 08:26:50
- Algaris
- Member
- From: England
- Registered: 2006-01-27
- Posts: 551
Re: smd_macro: Create custom virtual Txp tags that do stuff
redbot wrote:
Hey Bloke,
this is a little OT here but I begin to think smd_macro should stop being a plugin, instead it should entirely replace txp forms in the next texpattern release.
mrdale wrote:
This thought crossed my mind too. Basically adding attributes to forms would make them far more useful.
I concur with this. It would be an amazing addition to the core.
Offline