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: 7,586
Website

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,249
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: 7,586
Website

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
Moderator
From: Germany
Registered: 2005-01-20
Posts: 2,561
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,249
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
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 – The BombsiteProText ThemesTextgarden

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: 3,882

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: 856
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
Admin
From: The Netherlands
Registered: 2004-06-06
Posts: 7,453
Website

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

Wow :)


<txp:Els /> ;)
Tag Reference | Unexpected behaviour? Check the tag trace | Still no clue? Check the names of your custom fields

Offline

#10 2011-03-17 12:42:48

candyman
Member
From: Italy
Registered: 2006-08-08
Posts: 675

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

Board footer

Powered by FluxBB