Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
smd_macro: Create custom virtual Txp tags that do stuff
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 Textpattern tags and markup? 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. Check the changelog for version information.
You’re not limited to galleries of course. You can create a macro to do absolutely anything: combine Txp tags, plugin tags, PHP, images, videos, whatever the heck you like and you can call it just like a regular Txp tag from your public site. You could even use it to simplify your own workflow. So next time a client says “I wish it was easier to put stuff into articles” your can smile a knowing smile, charge them a little extra and take advantage of MacroPower :-)
Conceptually, there’s very little to the plugin: visit Content->Macros with a suitably charged user account, give your macro a name (please read the docs, the name has restrictions), a bunch of attributes/defaults if required, and then type your macro definition. Save it and you’re good to go. Inside your definition you can put {replacement}
tags which will inject the values from your attributes if the client supplied them.
You can clone macros if you’re making a bunch of similar ones and you can also export them to a text file for safe keeping or share them with others, whereby the handy import feature makes it easy to load them in.
No more excuses. Become macrolicious.
Last edited by Bloke (2017-01-21 08:38:40)
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
Re: smd_macro: Create custom virtual Txp tags that do stuff
A plugin to magically create public plugins?
Piwik Dashboard, Google Analytics Dashboard, Minibar, Article Image Colorpicker, Admin Datepicker, Admin Google Map, Admin Colorpicker
Offline
Re: smd_macro: Create custom virtual Txp tags that do stuff
MattD wrote:
A plugin to magically create public plugins?
Just supply your own magic :-)
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
Re: smd_macro: Create custom virtual Txp tags that do stuff
Lovely. Just lovely!
TXP Builders – finely-crafted code, design and txp
Offline
Re: smd_macro: Create custom virtual Txp tags that do stuff
Pretty powerful. I just duplicated the functionality of msd_snowflakes (my only public side plugin) in 15 minutes.
Piwik Dashboard, Google Analytics Dashboard, Minibar, Article Image Colorpicker, Admin Datepicker, Admin Google Map, Admin Colorpicker
Offline
Re: smd_macro: Create custom virtual Txp tags that do stuff
Mmmm. Yummy! I may just have to play with this one Stef.
Stuart
In a Time of Universal Deceit
Telling the Truth is Revolutionary.
Offline
#7 2011-03-17 01:25:49
- uli
- Moderator
- From: Cologne
- Registered: 2006-08-15
- Posts: 4,310
Re: smd_macro: Create custom virtual Txp tags that do stuff
Sounds like yield/output_form on steroids. All the possibilities … I’m passing out …
In bad weather I never leave home without wet_plugout, smd_where_used and adi_form_links
Offline
Re: smd_macro: Create custom virtual Txp tags that do stuff
Sounds Good – Downloading now :)
Offline
#9 2011-03-17 08:14:21
- els
- Moderator
- From: The Netherlands
- Registered: 2004-06-06
- Posts: 7,458
Re: smd_macro: Create custom virtual Txp tags that do stuff
Wow :)
Offline
#10 2011-03-17 12:42:48
- candyman
- Member
- From: Italy
- Registered: 2006-08-08
- Posts: 684
Re: smd_macro: Create custom virtual Txp tags that do stuff
Great. Thanks Stef!
MattD wrote:
Pretty powerful. I just duplicated the functionality of msd_snowflakes (my only public side plugin) in 15 minutes.
I used it! It would be nice put it as another example in the plugin docs.
Offline
Re: smd_macro: Create custom virtual Txp tags that do stuff
candyman wrote:
It would be nice put it as another example in the plugin docs.
Matt could always export and share it with you :-)
Last edited by Bloke (2011-03-17 14:08:32)
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
Re: smd_macro: Create custom virtual Txp tags that do stuff
“3 year old boy, I’d like you to meet mr. glock” …now go play. ;)
Can you imagine the havok a pixel pusher like me could cause with this bad boy?
Now… if you can include macros in macros… “hello mr. howitzer”
Last edited by mrdale (2011-03-17 15:16:45)
Offline