Archive for the ‘php’ Category
New line to paragraph in PHP
Here’s an example of how to convert new line (LF – line feed, ‘\n’) or carriage return (CR, ‘\r’) followed by new line (CR+LF, ‘\r\n’) to <br> or <p>. In case of double or more breaks we’ll get a paragraph but in case of one break we’ll have <br>.
$text = 'Lorem ipsum\r\n\r\ndolor sit\r\namet.'; // double or more nl to <p> $text = preg_replace('/(\r?\n){2,}/', '</p><p>', $text); // nl to <br> $text = preg_replace('/(\r?\n)+/', '<br />', $text); echo '<p>' . $text . '</p>';
output: <p>Lorem ipsum</p><p>dolor sit<br />amet.</p>
How to execute additional SQL in After Execute family events in CCS
Hi! This article is about how to execute some addtitional SQL after the primary SQL in the CodeCharge Studio’s Record has been executed.
Very often I have to perform some additional manipulations with the database after the Record submission. In this article I want to share the approach I use to reach the desired result. If you use a different approach to reach the same result I’m waiting your comments!
