Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#21 2011-03-20 18:23:38

renobird
Member
From: Gainesville, Florida
Registered: 2005-03-02
Posts: 786
Website

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

staring at monitor with mouth wide open

Brilliant. Completely brilliant.

Offline

#22 2011-03-20 18:23:57

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

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.

Txp Builders – finely-crafted code, design and Txp

Offline

#23 2011-03-20 18:49:10

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:

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: 459

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

#25 2011-03-21 18:44:31

maruchan
Member
From: Ukiah, California
Registered: 2010-06-12
Posts: 585
Website

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

#26 2011-03-21 21:28:46

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

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.

Txp Builders – finely-crafted code, design and Txp

Offline

#27 2011-03-27 22:06:04

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

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.

Txp Builders – finely-crafted code, design and Txp

Offline

#28 2011-03-27 23:16:24

maverick
Member
From: Southeastern Michigan, USA
Registered: 2005-01-14
Posts: 975
Website

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

#29 2011-03-28 10:28:35

stickid
Member
From: Bremen, Germany
Registered: 2009-02-14
Posts: 15
Website

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

#30 2011-03-28 10:43:44

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

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.

Txp Builders – finely-crafted code, design and Txp

Offline

Board footer

Powered by FluxBB