Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2011-03-16 22:46:27

Bloke
Developer
From: Leeds, UK
Registered: 2006-01-29
Posts: 11,436
Website GitHub

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

#2 2011-03-16 23:13:28

MattD
Plugin Author
From: Monterey, California
Registered: 2008-03-21
Posts: 1,254
Website

Re: smd_macro: Create custom virtual Txp tags that do stuff

A plugin to magically create public plugins?


My Plugins

Piwik Dashboard, Google Analytics Dashboard, Minibar, Article Image Colorpicker, Admin Datepicker, Admin Google Map, Admin Colorpicker

Offline

#3 2011-03-16 23:15:34

Bloke
Developer
From: Leeds, UK
Registered: 2006-01-29
Posts: 11,436
Website GitHub

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

#4 2011-03-16 23:16:57

jakob
Admin
From: Germany
Registered: 2005-01-20
Posts: 4,719
Website

Re: smd_macro: Create custom virtual Txp tags that do stuff

Lovely. Just lovely!


TXP Builders – finely-crafted code, design and txp

Offline

#5 2011-03-16 23:32:01

MattD
Plugin Author
From: Monterey, California
Registered: 2008-03-21
Posts: 1,254
Website

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.


My Plugins

Piwik Dashboard, Google Analytics Dashboard, Minibar, Article Image Colorpicker, Admin Datepicker, Admin Google Map, Admin Colorpicker

Offline

#6 2011-03-17 00:12:21

thebombsite
Archived Plugin Author
From: Exmouth, England
Registered: 2004-08-24
Posts: 3,251
Website

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,306

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

#8 2011-03-17 01:33:03

tye
Member
From: Pottsville, NSW
Registered: 2005-07-06
Posts: 859
Website

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

#11 2011-03-17 14:08:12

Bloke
Developer
From: Leeds, UK
Registered: 2006-01-29
Posts: 11,436
Website GitHub

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

#12 2011-03-17 15:16:24

mrdale
Member
From: Walla Walla
Registered: 2004-11-19
Posts: 2,215
Website

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

Board footer

Powered by FluxBB