You are not logged in.
Pages: 1
The plugin, rah_replace, returns contained content with all occurances replaces with given replacements. It supports multiple replacemens.
<txp:rah_replace from="something,to,change" to="into">
This is something that is going to change into.
</txp:rah_replace>
Already a bit older(ish) plugin of mine. Noticed that it didn’t have a support topic, so decided to create one. Also, today is the day when rah_replace got it’s first update; Version 0.2 adds delimiter attribute.
Rah-plugins | What? I’m a little confused… again :-) <txp:is_god />
Online
Hi Jukka, nice plugin, thanks! Is it possible to replace line endings (\r\n etcetera) as well? I tried it using all kind of quotes, but can’t get it to work. I’m trying to use it around the output_form tag in <body class="<txp:output_form form="body_class" />">. The form contains a lot of conditional tags, so in the end the output is something like this:
<body class="[lots of blank lines]class-name[more lots of blank lines]">
And yes, I can remove the line endings from my form, but for legibility I’d rather not do that.
<txp:Els /> ;)
Tag Reference
Offline
<body class="<txp:php>echo str_replace("\r\n", '', output_form(array('form'=>'body_class')));</txp:php>">
edit: fixed code
Last edited by ruud (2009-08-16 22:07:34)
Offline
Thanks, Ruud :) But:
<body class="<br />
<b>Warning</b>: Unexpected character in input: '\' (ASCII=92) state=1 in <b>/path/to/textpattern/publish/taghandlers.php(3127) : eval()'d code</b> on line <b>1</b><br />
<br />
<b>Parse error</b>: syntax error, unexpected T_STRING in <b>/path/to/textpattern/publish/taghandlers.php(3127) : eval()'d code</b> on line <b>1</b><br />
">
<txp:Els /> ;)
Tag Reference
Offline
Els wrote:
Hi Jukka, nice plugin, thanks! Is it possible to replace line endings (\r\n etcetera) as well?
Well not literally, but you can really easily replace line breaks. For example:
<txp:rah_replace from="
" to="">
1
2
3
</txp:rah_replace>
becomes:
123
Last edited by Gocom (2009-08-16 22:08:37)
Rah-plugins | What? I’m a little confused… again :-) <txp:is_god />
Online
Ah, I see, thanks. Meanwhile, Ruud solved the problem elsewhere, so I won’t be needing rah_replace at the moment. But I’ll certainly keep it in mind!
<txp:Els /> ;)
Tag Reference
Offline
Pages: 1