Preg_replace

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

By jenolan - September 20, 2013

My suggestion ;-)

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

---
<?= "Jenolan(Larry) :: Coding Since 1973" ?>
Peace and Long Life

By design9 - September 23, 2013

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

By jenolan - September 23, 2013

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

---
<?= "Jenolan(Larry) :: Coding Since 1973" ?>
Peace and Long Life

By design9 - September 24, 2013

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/

By design9 - September 24, 2013

Thanks Jason!

That is perfect, exactly what I needed!

April