Results 1 to 5 of 5

Thread: c++ bbcode system problem with html = #include <header.h>

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Oct 2004
    Location
    UK
    Posts
    119

    c++ bbcode system problem with html = #include <header.h>

    hello I have a very awkward problem, I've made a code system for normal code and one for php so that the output is highlighted however I have a problem with code that is C++.

    Due to the nature of the code e.g.

    Code:
    #include <header>
    the php script will take not display <header> instead its hidden in the actual source of the html. Example:

    Code:
    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;#include <iostream><br />
    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;#include <string><br />
    The output is #include without the <headers>, any suggestions.

  2. #2

    Thread Starter
    Lively Member
    Join Date
    Oct 2004
    Location
    UK
    Posts
    119

    Re: c++ bbcode system problem with html = #include <header.h>

    well I worked out I need to use htmlentities but now I'm havnig problems with double quotes, it puts a \ before the quote, I need the quote to be left alone.

  3. #3
    I'm about to be a PowerPoster!
    Join Date
    Jan 2005
    Location
    Everywhere
    Posts
    13,647

    Re: c++ bbcode system problem with html = #include <header.h>

    Turn off Magic Quotes in php.ini.

    If you don't have access to that, you can use a different quote conversion method:

    PHP Code:
    echo htmlentities($codeENT_QUOTES); 
    But you should turn off magic quotes if you can anyway, its a silly feature.

  4. #4

    Thread Starter
    Lively Member
    Join Date
    Oct 2004
    Location
    UK
    Posts
    119

    Re: c++ bbcode system problem with html = #include <header.h>

    I've tried that and cannot get it going, heres what I'm using:

    PHP Code:
    function code($str){
        
            
    $match = array('#\[code\](.*?)\[\/code\]#se');
            
    $replace = array("'<table width=\"95%\" align=\"center\"><tr><td class=\"php_head\"><b><u>Code Snippet</u></b></td></tr><tr valign=\"top\"><td class=\"code_body\" align=\"left\">'.htmlentities('$1', ENT_QUOTES).'</td></tr></table>'");
            return 
    preg_replace($match$replace$str);
            
        } 
    OUTPUT:

    cout << endl << \"\tWhat is your name? \";

    system(\"pause\");
    return 0;


    really messes up my C++ code also I'm on shared hosting, I will have to ask my host about magic quotes. Mean time any other suggestions?

  5. #5
    I'm about to be a PowerPoster!
    Join Date
    Jan 2005
    Location
    Everywhere
    Posts
    13,647

    Re: c++ bbcode system problem with html = #include <header.h>

    Use stripslashes() on the resultant output.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width