Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2020-07-07 07:02:48

colak
Admin
From: Cyprus
Registered: 2004-11-20
Posts: 8,159
Website

[SOLVED] txp:site_name

Is there a way to add underscores to site_names that include spaces? ie. I’m looking for a way to convert “My txp Site” to “My_txp_Site” (in relation to this post).

Edited to add that trimming spaces would also be acceptable but <txp:site_name trim=" " /> did not work.

Last edited by colak (2020-07-07 07:22:57)


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

#2 2020-07-07 08:08:04

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

Re: [SOLVED] txp:site_name

Trim:

<txp:site_name trim="/\s+/" />

Replace:

<txp:site_name trim="/\s+/" replace="_" />

or simply

<txp:site_name trim replace="" /> and <txp:site_name trim replace="_" />

Offline

#3 2020-07-07 08:41:22

colak
Admin
From: Cyprus
Registered: 2004-11-20
Posts: 8,159
Website

Re: [SOLVED] txp:site_name

etc wrote #324331:

Trim:

<txp:site_name trim="/\s+/" />...

Replace:

<txp:site_name trim="/\s+/" replace="_" />...

These work beautifully. Thanks so much Oleg.


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

#4 2020-07-07 08:49:06

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

Re: [SOLVED] txp:site_name

It’s even documented :-)

Offline

#5 2020-07-07 10:15:10

colak
Admin
From: Cyprus
Registered: 2004-11-20
Posts: 8,159
Website

Re: [SOLVED] txp:site_name

etc wrote #324334:

It’s even documented :-)

I did see that but I didn’t know that there was a regex for the space character hence my example in the first post of 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

Board footer

Powered by FluxBB