EllisLab text mark
Advanced Search
     
Nesting with the EE find and replace plugin
Posted: 24 June 2008 07:45 AM   [ Ignore ]
Joined: 2008-05-23
31 posts

This topic has kinda been discussed in http://ellislab.com/forums/viewthread/69672/ but what I am trying to accomplish is a little different…

In a nutshell, I want this to work:

{exp:replace find="\n" replace="SPACE"}
     {exp
:replace find="QUOTE" replace="\QUOTE"}
          {body}
     {
/exp:replace}
{
/exp:replace} 

However, it doesn’t. It just outputs the string with a literal “{/exp:replace}” at the end. Based on what I read in the thread noted above, this is normal behaviour.

So, my question is whether or not there’s a way to get this plugin to do what I want it to do any other way?

I just need to covert the {body} into a single line (remove all newlines) and escape all double quotes so that it can be safely used in the JavaScript for that cool pop-up balloon thingy in Google Maps.

I also tried this:

{exp:replace find="QUOTE|\n" replace="\QUOTE|SPACE" multiple="yes"}
     {body}
{
/exp:replace} 

.... but it doesn’t seem to want to play… :-(

 
Posted: 25 June 2008 05:48 AM   [ Ignore ]   [ # 1 ]   [ Rating: 0 ]
Joined: 2008-05-23
31 posts

If anyone can think of anything, please let me know. For now, I’m resorting to PHP to do what I need to do:

{exp:weblog:entries entry_id="18"}
    <?php
        $string 
='{body}';
        
$string addslashes($string);
        
$string preg_replace"/\n/"''$string );
        echo 
"html =\"".$string."\";";
    
?>
{
/exp:weblog:entries}