Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
#325 2020-01-22 16:06:35
Re: etc_query: all things Textpattern
If you don’t mind using (a very useful) plugin, you can do it more simply with smd_wrap.
See Example 7 in the docs for the auto_excerpt case. If you wrap that additionally in <txp:if_excerpt><txp:excerpt /><txp:else /> … </txp:if_excerpt>
, then your own excerpt will be used if it exists first.
@bloke: you have a v0.3 of this plugin but it’s not available online in compiled form. I’ll see if I can find mine… It is now, and you can find it here (thanks bloke :-).
@Karsten: If you let us know which other plugins you are needing to update, we may be able to advise…
TXP Builders – finely-crafted code, design and txp
Offline
#326 2020-01-22 23:10:38
Re: etc_query: all things Textpattern
@jakob: Thanks, released.
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
Online
#327 2020-01-23 15:40:44
Re: etc_query: all things Textpattern
@jakob THANKS
this is briljant, and does exactly what I want:
<txp:smd_wrap_all transform=“strip_tags, cut|35w|…”>
<txp:body />
</txp:smd_wrap_all>
Simply gives the first 35 words of the body text, that was what I needed!
As for other plugins that stopped working: rah_textile_bar
This was a useful tool that added buttons to apply textile, very convenient to use! But is doesn’t seem to do anything any more. If I come across more plugins that have failed I will let you know.
Offline
#328 2020-01-23 16:11:24
Re: etc_query: all things Textpattern
Not that I’m jealous, but now (4.8-dev) you can get it in core:
<txp:body escape="tags" trim="/^\W*((?:\w+\W+){35})\w.*$/s" replace="$1…" />
Offline
#329 2020-01-23 16:44:43
Re: etc_query: all things Textpattern
etc wrote #321296:
Not that I’m jealous, but now (4.8-dev) you can get it in core:
<txp:body escape="tags" trim="/^\W*((?:\w+\W+){35})\w.*$/s" replace="$1…" />...
Oleg,
You never cease to amaze me! This is way beyond what I expected txp to do out of the box!!! I cannot even pretend that I understand the syntax, but I am incredibly impressed.
We should add the above in the docs under the body and excerpt as it seems to be of use for many.
Yiannis
——————————
NeMe | hblack.art | EMAP | A Sea change | Toolkit of Care
I do my best editing after I click on the submit button.
Offline
#330 2020-01-23 17:26:53
Re: etc_query: all things Textpattern
It’s brilliant. I’ll add that example to the docs for the excerpt tag.
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
Online
#331 2020-01-23 17:48:07
Re: etc_query: all things Textpattern
Offline
#332 2020-01-23 17:51:01
Offline
#333 2020-01-23 17:59:38
Re: etc_query: all things Textpattern
etc wrote #321301:
Wouldn’t it fit better as new global
replace
attribute example (since we have to document it anyway)?
Sure, we can add something similar there too. Or maybe another type of example. Just thought it’d be nice for people who are looking to excerpt an article to see there are a few ways to do it without having to use the tag itself.
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
Online
#334 2020-01-23 18:03:07
Re: etc_query: all things Textpattern
Question: for documentation purposes, does replace
only work to replace stuff matched by trim
or can it be used on its own?
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
Online
#335 2020-01-23 18:12:50
Re: etc_query: all things Textpattern
Bloke wrote #321304:
Question: for documentation purposes, does
replace
only work to replace stuff matched bytrim
or can it be used on its own?
Hmm, what could it replace without trim
? If you see…
Edit: probably replace
is misleading. What is the opposite of trim
?
Offline
#336 2020-01-23 18:32:39
Re: etc_query: all things Textpattern
etc wrote #321305:
Hmm, what could it replace without
trim
? If you see…
I figured as much. Just wasn’t sure if the regex syntax could be used like sed with /find/replace/g
. But that’s probably pushing it!
I agree that trim/replace isn’t the most obvious pairing but can’t think of anything else.
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
Online