Support » How-To and Troubleshooting » [Resolved] hep! – str_replace

[Resolved] hep! – str_replace

  • Hey

    I’m working on cformsll. maybe you can help me how to figure this thing.

    add_post_meta($ppost_id, 'externalpost', str_replace("\n",'<br />',$form['externalpost']));

    the result will be


    i want to make it to be


    Any clues?

Viewing 1 replies (of 1 total)
  • I was looking for a solution for for the same problem, and found one that helped me, I hope it can help you.

    In this forum, I found this piece of code:

    function dostuff($str) {
    return "<ul>" . preg_replace(array("/^\s+/s", "/(.*?)(\r?\n)+/gs"), array("", "<li>$1</li>"), $str . "\r\n") . "</ul>";

    I think you could write something like:

    add_post_meta($ppost_id, 'externalpost', preg_replace(array("/^\s+/s", "/(.*?)(\r?\n)+/gs"), array("", "<li>$1</li>"), $str . "\r\n"));

    I hope this would be useful!

Viewing 1 replies (of 1 total)
  • The topic ‘[Resolved] hep! – str_replace’ is closed to new replies.