Jump to content

Help to create a forum - BBCodes


gaza165

Recommended Posts

  • Replies 61
  • Created
  • Last Reply

Top Posters In This Topic

Popular Days

Top Posters In This Topic

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.

Link to comment
Share on other sites

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);

Link to comment
Share on other sites

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

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


×
×
  • 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.