Preg_replace

7 posts by 3 authors in: Forums > CMS Builder
Last Post: September 24, 2013   (RSS)

My suggestion ;-)

<?php echo string_ireplace( '</p>', '<br />', $articlesRecord['content']); ?>

---



Peace and Long Life

Sorry, that doesn't work, that gives me an error on page.

That should work you need to show a before and after to give me a little bit if a hint.

---



Peace and Long Life

Here is the error I get:

Fatal error: Call to undefined function string_ireplace() in C:\inetpub\carolinaparent\newarticlemain.php on line 234

My page is attached.

Thanks so much!

Attachments:

newarticlemain.php 19K

By Jason - September 24, 2013

Hi,

The issue is just a typo in the code.   The function name is str_ireplace().  The only issue I can see with this, is that it will leave a lot of open <p> tags in your HTML, to strip those out as well, give this a try:

<p><?php echo str_replace("</p>", "<br/>", str_replace("<p>", "", $articlesRecord['content']));?></p>

Hope this helps

---------------------------------------------------
Jason Sauchuk - Project Manager
interactivetools.com

Hire me! Save time by getting our experts to help with your project.
http://www.interactivetools.com/consulting/

Thanks Jason!

That is perfect, exactly what I needed!

April