Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#16 2024-01-19 07:00:46

Pat64
Plugin Author
From: France
Registered: 2005-12-12
Posts: 1,680
GitHub Twitter

Re: exclude article

Well.
A few days ago, working on a new project, I encounter a strange behavior.

Based on this sentence: “Dans un véritable récit de voyage, le scientifique retrace son parcours de chercheur et nous entraîne dans une étonnante enquête archéologique.” and your code:

<txp:hide process="1" trim="/^\s*(.{95}\w*)\b.+$/s" replace='$1… <a href="<txp:permlink />">Lire la suite</a>'>
	<txp:body />
</txp:hide>

The result produced this:

Dans un véritable récit de voyage, le scientifique retrace son parcours de chercheur et nous entra… Lire la suite

The final î character is changed by a not well encoding sign (can’t include it here because Textile rejects the sign: a question mark).

Note: I’m using TXP 4.9-dev for devs demand testing by users on a local server (MAMP for PCs, PHP version: 8.0.1, MySQL: 5.7.24). Sometimes when I change the length of the REGEX (words count below {104}), the entire page crashes (nothing is rendering)…


Patrick.

Github | CodePen | Codier | Simplr theme | Wait Me: a maintenance theme | [\a mi.ni.ma]: a “Low Tech” simple Blog theme.

Offline

#17 2024-01-19 08:48:05

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

Re: exclude article

Ah, ok, this pattern. It’s not a bug, you need to add u modifier to regex for Unicode:

<txp:hide process="1" trim="/^\s*(.{95}\w*)\b.+$/us" replace='$1… <a href="<txp:permlink />">Lire la suite</a>'>
	<txp:body />
</txp:hide>

Offline

#18 2024-01-19 09:48:00

Pat64
Plugin Author
From: France
Registered: 2005-12-12
Posts: 1,680
GitHub Twitter

Re: exclude article

Perfect, Oleg. You are a programming master!


Patrick.

Github | CodePen | Codier | Simplr theme | Wait Me: a maintenance theme | [\a mi.ni.ma]: a “Low Tech” simple Blog theme.

Offline

#19 2024-01-19 10:05:06

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

Re: exclude article

Certainly not. It’s a lowercase u, sorry.

More useful info here.

Offline

Board footer

Powered by FluxBB