Jump to content

Help to create a forum - BBCodes


gaza165

Recommended Posts

  • Replies 61
  • Created
  • Last Reply

I am pulling my hair out over this i really have no idea what to do with this code...

 

I have no idea what to do with it!!!

 

Can i please have the code, just want to get this finished.

 

 

 

it took me days of paper work to get lists within lists from bbcode (2 days)

 

you need to map it out on paper there is no simple code m8, you need to split it up into an array then take the chucnks using p1 p2 and string chop or wotever. iv already put you half way there.

Use htmlspecialshars instead

 

Change the highlight_php function to this

function highlight_php($matches)
{
    $code = preg_replace("#(\[code\]|\[/code\])#is", "", $matches[0]);

    $code = htmlspecialchars_decode($code);

    //highlight PHP Code
    $code = highlight_string($code, true);

    //Encode certain HTML chars into ASCII Code
    $html_chars = array("[", "]");
    $html_ASCII = array("[", "]");
    $code = str_replace($html_chars, $html_ASCII, $code);

    return '<div class="code">' . $code . '</div>';
}

 

Now change

 

echo docode($test);

 

to

 

$test = htmlspecialchars($test);

echo docode($test);

Use htmlspecialshars instead

 

Change the highlight_php function to this

function highlight_php($matches)
{
    $code = preg_replace("#(\[code\]|\[/code\])#is", "", $matches[0]);

    $code = htmlspecialchars_decode($code);

    //highlight PHP Code
    $code = highlight_string($code, true);

    //Encode certain HTML chars into ASCII Code
    $html_chars = array("[", "]");
    $html_ASCII = array("[", "]");
    $code = str_replace($html_chars, $html_ASCII, $code);

    return '<div class="code">' . $code . '</div>';
}

 

Now change

 

echo docode($test);

 

to

 

$test = htmlspecialchars($test);

echo docode($test);

 

 

regular expressions rule, i need to learn more

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.