Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
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
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
Re: Short-tags and shortcodes
etc wrote #310556:
Shortcodes functionality does not depend on short-tag settings
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
Re: Short-tags and shortcodes
Bloke wrote #310557:
Even if I make my shortcode Form name
figure
I still need theyield
attribute if I want to pass in attributes. Otherwise it complainsUnknown 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
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
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
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
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 Ignore me.<txp:output_form name="figure" />
instead of form="figure"
, right? But that should still complain if the mandatory attribute’s missing.
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