No announcement yet.

small hint regarding cleaner.php

  • Filter
  • Time
  • Show
Clear All
new posts

  • Marco van Herwaarden
    You would need to either escape the embedded quotes (with a backslash \), or use single quotes around the string:

    PHP Code:
     '<font color="0000ff">' => "[color=blue]"

    Leave a comment:

  • antiekeradio
    started a topic small hint regarding cleaner.php

    small hint regarding cleaner.php


    after the import (with which Marco van H. has helped us out superbly!! thumbs up mate )

    I was cleaning up some of the code pieces from the old board layout.

    Unfortunately there was a sneaky thing in there, some of the strings I want to replace have the " character in them.

    example; I would like to replace all instances of <font color="0000ff"> with the appropriate vB code.

    fill this in in the array in cleaner.php: (line 51 and further)

    $replacer = array(
       "<font color="0000ff">" => "[COLOR=blue]",
    due to the ", the first part of the array becomes: "<font color="

    and afterwards there is another unexpected ".


    Parse error: syntax error, unexpected T_LNUMBER, expecting ')' in /var/xirictrl/hosted/www/volvo300club/ on line 51

    After some experimenting I figured php has a way to distinguish between 'code " ' and 'text " '

    I tried the following array as well:

     "<font color=/"0000ff/">" => "[COLOR=blue]",
    but that didn't work.

    consulted PHP manual, finally found out that i was using the wrong slash.

    so... this is what worked for me:

     "<font color=\"0000ff\">" => "[COLOR=blue]",
    so, the hint is, if you have to replace " s in your text, include a trailing backslash \ to tell php its not the end of the code piece.
widgetinstance 262 (Related Topics) skipped due to lack of content & hide_module_if_empty option.