Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#16 2018-04-01 10:14:37

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

Re: Attributes for txp:yield?

Destry wrote #310521:

Looking at this closer, I think there might be a discrepancy here against what I intended.

In my original example, the name="" attribute wasn’t pulling from a link data item, it was a free attribute to type in any name value a person wants for that given aside. If not used, nothing outputs.

I don’t think that’s how this integrated example of etc’s is designed, though. Am I wrong?

I have adapted the example to recent commits, it should work as you describe now.

Offline

#17 2018-04-01 11:48:51

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

Re: Attributes for txp:yield?

etc wrote #310529:

…it should work as you describe now.

Thanks. I’ve updated the doc example

So, besides being a good excuse to demonstrate another way to juggle tag structure, the only real advantage with this example is being able to output multiple links in one place with a single tag. I can’t imagine ever doing that myself based on the purpose of this particular shortcode, but okay.

I’m not sure how that would impact using the free name attribute though — e.g. what if you needed three different names parsed to each link quote (name values are not pulled from the link data) — but it would work fine with one ID, as normal.

In any case, I made a relevant comment about that in the doc. People have to explore a bit and learn how to adapt. We can’t do cookie-cut code for every scenario, after all. ;)

Offline

#18 2018-04-01 12:27:07

jakob
Admin
From: Germany
Registered: 2005-01-20
Posts: 5,229
Website GitHub

Re: Attributes for txp:yield?

Bloke wrote #310527:

Awesome!

+1 – Excellent! Big thanks for adding this Oleg.

I like the way you have implemented it as an extension of the existing wraptag attribute for ‘freeform’ wrap scenarios with a placeholder for the content. It introduces no new attributes and is more succinct to write in code too. I take it this will work everywhere where wraptag is a valid attribute?

I don’t mind <+> as a choice of placeholder either. It’s not likely to conflict with an other needs like an @, #, or | might, and looks like a placeholder.


TXP Builders – finely-crafted code, design and txp

Offline

#19 2018-04-01 12:58:28

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

Re: Attributes for txp:yield?

jakob wrote #310534:

I don’t mind <+> as a choice of placeholder either.

Agree. Anything else might be more confusing, in fact.

Offline

#20 2018-04-01 19:39:03

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

Re: Attributes for txp:yield?

Destry wrote #310531:

So, besides being a good excuse to demonstrate another way to juggle tag structure, the only real advantage with this example is being able to output multiple links in one place with a single tag.

Not really, that was already possible with your structure. The main difference is that if you provide a wrong (not existing) id, your snippet will output an empty <aside></aside>, and mine will output nothing. Plus the possibility to wrap linklist in other tags that aside. Both are ok depending on users needs.

jakob wrote #310534:

I take it this will work everywhere where wraptag is a valid attribute?

It will work with every tag processing wraptag via doWrap() (or rather tag()) function. This includes core and most plugins, but if a plugin author decides to treat wraptag differently, (s)he can.

Offline

#21 2018-04-01 20:53:25

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

Re: Attributes for txp:yield?

etc wrote #310540:

main difference is that if you provide a wrong (not existing) id, your snippet will output an empty <aside></aside>, and mine will output nothing. Plus the possibility to wrap linklist in other tags that aside.

Good points! That first one is kind of funny. I can’t imagine anyone making that mistake and not catching it after a front-side verification. I’m a front-side verifier to a fault. Type a word, I must go check it! :)

The layers to this onion are too many for me to keep track of.

Thanks again.

Offline

#22 2018-04-02 08:38:23

Bloke
Developer
From: Leeds, UK
Registered: 2006-01-29
Posts: 12,502
Website GitHub

Re: Attributes for txp:yield?

etc wrote #310528:

that is a bug (not recent though) that appears on successive form calls

Thanks for the patch. Working smoothly now. Rockin’.


The smd plugin menagerie — for when you need one more gribble of power from Textpattern. Bleeding-edge code available on GitHub.

Hire Txp Builders – finely-crafted code, design and Txp

Offline

Board footer

Powered by FluxBB