Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
#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: North Wales, UK
- Registered: 2005-11-25
- Posts: 1,095
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.
Hire Txp Builders – finely-crafted code, design and Txp
Offline
#23 2011-03-20 18:49:10
- masa
- Member
- From: North Wales, UK
- Registered: 2005-11-25
- Posts: 1,095
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: 607
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
Re: smd_macro: Create custom virtual Txp tags that do stuff
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.
This would be wonderful. Now that macros are here I’m thinking of ways to get around my clients typing in any txp tags. :-)
…so spoiled.
Last edited by maruchan (2011-03-21 18:44:43)
Offline
Re: smd_macro: Create custom virtual Txp tags that do stuff
maruchan wrote:
Now that macros are here I’m thinking of ways to get around my clients typing in any txp tags. :-)
:-) I hadn’t really thought it a good use of code to duplicate what the tag builder does. That’s what you’re asking for, right? A way for someone to click a button and have it ask for all the attributes and then stuff the full macro tag at the cursor position?
With the best will in the world, the closest I could do is to perhaps use reflection to query the tag and put up a bunch of textboxes to allow people to type the values in. But what if one of your attributes was category or author or priv_level? How would I know to go and build a dropdown list of categories, authors or user groups? I suppose some inference could be made based on the name but what if you’d called your attributes rod, jane and freddy instead?
So as utopian as this sounds, I don’t think it’s within my expertise as a programmer. Unless someone can realign my thinking with some insight into how I might achieve such a beast in practice?
As I’ve alluded to already, I have a side project to help build macros for use with the image side of things. Anyone interested can always get in touch.
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: smd_macro: Create custom virtual Txp tags that do stuff
v0.11 fixes a tiny oversight if you are nesting macros. Essentially you were previously limited to two ‘levels’ but now that restriction is gone.
After upgrade you should probably resave each of your macros so the changes are propagated to them all, although if you’re not using macros-in-macros-in-tags-in-macros-in-attributes-in-tags or something equally mad, it’s probably not necessary right away as the v0.10 way of doing things is sufficient.
Thanks to maverick for stress-testing this and finding the limitation.
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: smd_macro: Create custom virtual Txp tags that do stuff
Bloke
Thanks for bending smd_macro to my crazy macro design. :)
It’s working great!
Mike
Offline
Re: smd_macro: Create custom virtual Txp tags that do stuff
Hi,
first of all a big “THANX” for this brilliant Plugin!
I am asking myself if there is a way to access the attribute-values directly in PHP-code … using {atr_name} seems not to work here …
Hrrgh … my fault … It works (I just forgot to put some ‘ “ ‘ around the {atr_name})
Last edited by stickid (2011-03-28 10:41:48)
Offline
Re: smd_macro: Create custom virtual Txp tags that do stuff
stickid wrote:
first of all a big “THANX” for this brilliant Plugin!
You’re welcome.
Hrrgh … my fault … It works (I just forgot to put some ‘ “ ‘ around the {atr_name})
Phew! I was going to say, I’m sure I tested it. Glad you got it going.
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