Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#321 2020-01-22 14:21:24

uli
Moderator
From: Cologne
Registered: 2006-08-15
Posts: 4,216

Re: etc_query: all things Textpattern

Karsten wrote #321259:

… which was long overdue, but as a result some plugins have stopped working, including rss_auto_excerpt.

Hi Karsten, the “long overdue” part makes me think that those plugins might be easy to repair following these two advice as most plugins were broken at some point (4.6?) and could be fixed that way. Advantage: You might continue using your existing plugin tags.

In case you want to benefit from 4.7’s from/to changes, here’s another easy fix. And some hints on how to repair several other plugins.


In bad weather I never leave home without wet_plugout, smd_where_used and adi_form_links

Offline

#322 2020-01-22 15:15:41

Karsten
Member
From: Leiden, Netherlands
Registered: 2011-04-24
Posts: 47
Website

Re: etc_query: all things Textpattern

Thanks, but I’m not really into PHP myself, wouldn’t really know where to start. On the forum page of the specific plugin it is simply stated that it is orphaned.

rah_metas can do more or less the same thing, but uses the functionality to generate meta tags (and this one does work in the newest TXP). So it should not be so difficult in itself. But unfortunately it is too difficult for me to figure it out

Offline

#323 2020-01-22 15:45:22

uli
Moderator
From: Cologne
Registered: 2006-08-15
Posts: 4,216

Re: etc_query: all things Textpattern

I can’t write a single line of PHP on my own, but I could with ease fix all plugins I used.

Mostly it’s been tag registration, which is as simple as pasting the code from the link here to the start of the plugin code, and for each tag your plugin provides you add a line with the function’s name, like Ruud explained.

As an example, here’s the complete list from com_connect, one tag on each line.

// Register tags if necessary.
if (class_exists('\Textpattern\Tag\Registry')) {
    Txp::get('\Textpattern\Tag\Registry')
        ->register('com_connect')
        ->register('com_connect_text')
        ->register('com_connect_email')
        ->register('com_connect_textarea')
        ->register('com_connect_select')
        ->register('com_connect_option')
        ->register('com_connect_checkbox')
        ->register('com_connect_radio')
        ->register('com_connect_serverinfo')
        ->register('com_connect_secret')
        ->register('com_connect_submit')
        ->register('com_connect_send_article')
        ->register('com_connect_value')
        ->register('com_connect_label')
        ->register('com_connect_if');
}

Just note the semicolon after the last register line. I.e. if you can write text with correct punctuation, you should have no difficulty.


In bad weather I never leave home without wet_plugout, smd_where_used and adi_form_links

Offline

#324 2020-01-22 15:46:01

colak
Admin
From: Cyprus
Registered: 2004-11-20
Posts: 7,760
Website

Re: etc_query: all things Textpattern

Hi Karsten,

rah_metas is no longer needed as txp currently offers meta description tags for sections, categories and individual pages.

Re the rss_auto_excerpt plugin, do check Oleg’s patch or preferably, experiment with Julian’s no plugins solution, and Oleg’s more optimised contribution, further down in the thread.


Yiannis
——————————
neme.org | hblack.net | LABS | State Machines | NeMe @ github | Covid-19; a resource
I do my best editing after I click on the submit button.

Offline

#325 2020-01-22 16:06:35

jakob
Admin
From: Germany
Registered: 2005-01-20
Posts: 3,750
Website

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

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

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

Offline

#327 2020-01-23 15:40:44

Karsten
Member
From: Leiden, Netherlands
Registered: 2011-04-24
Posts: 47
Website

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|&hellip;”>
<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

etc
Developer
Registered: 2010-11-11
Posts: 3,580
Website

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&hellip;" />

Offline

#329 2020-01-23 16:44:43

colak
Admin
From: Cyprus
Registered: 2004-11-20
Posts: 7,760
Website

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&hellip;" />...

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.org | hblack.net | LABS | State Machines | NeMe @ github | Covid-19; a resource
I do my best editing after I click on the submit button.

Offline

#330 2020-01-23 17:26:53

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

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

Offline

Board footer

Powered by FluxBB