Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#13 2018-03-31 17:09:05

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

Re: Short-tags and shortcodes

jakob wrote #310505:

Ok, so the end could read: <snip>

Done. Thanks for the clarification. I think this not behaviour is mentioned a few times as I wasn’t sure the best place for it. Could do with doing it once fully and pointing to it from elsewhere. Suggestions welcome.


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 2018-04-02 09:24:23

etc
Developer
Registered: 2010-11-11
Posts: 5,189
Website GitHub

Re: Short-tags and shortcodes

Sorry, When short-tag preference is disabled section is misleading:

If you opt to disable short-tag functionality in the Preferences panel, you can still use the shortcode Form via an output_form tag like this:

<txp:output_form yield form="figure" />

Shortcodes functionality does not depend on short-tag settings and is always available. Actually, you really need to use yield attribute only for forms with complex names, like

<txp:output_form yield form="My figure" />

because the shortcode notation <txp::My figure /> would puzzle the parser.

Offline

#15 2018-04-02 09:45:42

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

Re: Short-tags and shortcodes

etc wrote #310556:

Shortcodes functionality does not depend on short-tag settings

Better?

you really need to use yield attribute only for forms with complex names

Hmm, not in my tests. Even if I make my shortcode Form name figure I still need the yield attribute if I want to pass in attributes. Otherwise it complains Unknown tag attribute: id etc.


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 2018-04-02 10:38:51

etc
Developer
Registered: 2010-11-11
Posts: 5,189
Website GitHub

Re: Short-tags and shortcodes

Bloke wrote #310557:

Even if I make my shortcode Form name figure I still need the yield attribute if I want to pass in attributes. Otherwise it complains Unknown tag attribute: id etc.

A form called figure can be invoked as shortcode <txp::figure />, but a form called my figure can not, that’s what I meant.

Internally, <txp::shortcode /> is just an alias of <txp:output_form yield form="shortcode" />. The yield attribute means “store extra attributes as values of <txp:yield /> tags inside the form and don’t complain”. Should this be the default behavior of <txp:output_form />? Currently, without yield attribute it issues a Unknown tag attribute warning (whatever form name), but it would be a very minor backwards incompatibility to drop it and use yield mode by default.

Offline

#17 2018-04-02 11:00:52

Destry
Member
From: Haut-Rhin
Registered: 2004-08-04
Posts: 4,909
Website

Re: Short-tags and shortcodes

Any discrepencies were likely my fault in reorganzing/editing docs, which is exactly why I wanted people to review the changes.

Offline

#18 2018-04-02 11:03:54

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

Re: Short-tags and shortcodes

etc wrote #310559:

The yield attribute means “store extra attributes as values of <txp:yield /> tags inside the form and don’t complain”. Should this be the default behavior of <txp:output_form />?

Since the functionality to add arbitrary attributes to <txp:output_form> wasn’t available in prior versions, I don’t see any problem with this, and it’s one less attribute for people to have to add by hand.

What b/c issues could arise? I can’t think of any. Presumably we could still use yield="att1, att2, ..." to explicitly name attributes that we want to allow if any corner cases cropped up?

Last edited by Bloke (2018-04-02 11:04:26)


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

#19 2018-04-02 11:11:59

etc
Developer
Registered: 2010-11-11
Posts: 5,189
Website GitHub

Re: Short-tags and shortcodes

Destry wrote #310560:

Any discrepencies were likely my fault in reorganzing/editing docs, which is exactly why I wanted people to review the changes.

I’m to blame too for still changing things in beta, but we’ll nail it.

Bloke wrote #310561:

What b/c issues could arise? I can’t think of any. Presumably we could still use yield="att1, att2, ..." to explicitly name attributes that we want to allow if any corner cases cropped up?

It’s mostly “where’s my warning gone” :-) Ok, I will modify it this way. Sorry for constant doc rewrites it yields.

Offline

#20 2018-04-02 11:15:59

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

Re: Short-tags and shortcodes

etc wrote #310563:

It’s mostly “where’s my warning gone” :-)

Haha! Don’t think anyone would complain about that. Might be a slight issue if someone uses <txp:output_form name="figure" /> instead of form="figure", right? But that should still complain if the mandatory attribute’s missing. Ignore me.

Sorry for constant doc rewrites it yields.

No worries. A better user experience is the ultimate goal.


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