Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

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

Bloke
Developer
From: Leeds, UK
Registered: 2006-01-29
Posts: 9,780
Website

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
Moderator
From: Walla Walla
Registered: 2004-11-19
Posts: 2,212
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

#13 2011-03-17 15:33:13

Bloke
Developer
From: Leeds, UK
Registered: 2006-01-29
Posts: 9,780
Website

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

#15 2011-03-18 10:28:33

Bloke
Developer
From: Leeds, UK
Registered: 2006-01-29
Posts: 9,780
Website

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

#19 2011-03-18 14:33:54

mrdale
Moderator
From: Walla Walla
Registered: 2004-11-19
Posts: 2,212
Website

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

Board footer

Powered by FluxBB