Forum

Thread tagged as: Question

Replace or transform strings in template

I have a case where the DB has a string with comma separated values and In some cases it I need the commas in others I need a new line.

I've tried to use the replace attribute but I have not managed to achieve this? How can I do this?

<perch:content id="services" type="text" replace=",|<br/>" />

or

<perch:content id="services" type="text" replace=",|\n" />

Actually now that I see, the comma does not get replace even for any character. Is there a way to pipe string to other functions or something and get a mutation of that value and print it in the template

Abigail Stock

Abigail Stock 0 points

  • 4 years ago
Drew McLellan

Drew McLellan 2638 points
Perch Support

There is in Perch 3 - template filters. I don't have a solution for Perch 2

Perch 3? I had no idea there was a 3. Do you have a link to download and see Perch 3?

Abigail Stock said:

Perch 3? I had no idea there was a 3. Do you have a link to download and see Perch 3?

It not available yet, it's the future release with lots of new bells and whistles. I think 2.9 has been scrapped in favor of 3.0. :)

Read here. https://grabaperch.com/blog/archive/announcing-perch-and-perch-runway-3?utm_content=bufferdc091&utm_medium=social&utm_source=twitter.com&utm_campaign=buffer