Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 5 of 5

Thread: bbcode parser

  1. #1
    New to the CF scene
    Join Date
    Aug 2013
    Posts
    8
    Thanks
    0
    Thanked 0 Times in 0 Posts

    bbcode parser

    i am using bbcode parser can anyone help me to resolve little problem with bbcode parser to display code exsample of any programming language on the web site without exsecute script like this way
    Code:
    <?php
                    require 'nbbc.php';
                    $bbC = new BBCode();
                    $bbC->AddRule("", array(
                        'simple_start' => '<pre class="php">',
                        'simple_end'   => '</pre>',
                        'class'        => 'block',
                        'allow_in'     => null
                    ));
                    
                    echo $bbC->Parse('<?php echo "hello from php";?>');
                    ?>
    but question is if i dispaly entire code of php script how i can pass to $bbC->parse() . i tried but when i paste complete php script to like this
    PHP Code:
    $bbC->parse('if(isset($_POST['logsubmit']) && !isset($_POST['logsubmit']) == false){
        $logusername = $_POST['
    logusername'];
        $logpassword = $_POST['
    logpassword'];
        
        if(empty($logusername) || empty($logpassword)){
            $global_error[] = "enter username and password";
        }
        
        if(!empty($global_error)){
            foreach ($global_error as $loginfielderror){
                echo "<p>".$loginfielderror."</p>";
            }'
    ); 
    if i try in this way it give me errors and not display php script code

  • #2
    Senior Coder
    Join Date
    Jun 2008
    Location
    New Jersey
    Posts
    2,530
    Thanks
    45
    Thanked 259 Times in 256 Posts
    First problem, based on the top example, the function is Parse, not parse. Its case sensitive.

    And without knowing what the function does, that's the best help I can offer. Based on the top example, you'd need to wrap your PHP in the phrase function in PHP tags, but all in all, it seems convoluted, so I'm not sure what you're doing.

  • #3
    New to the CF scene
    Join Date
    Aug 2013
    Posts
    8
    Thanks
    0
    Thanked 0 Times in 0 Posts
    ok it's sure i don't know more about that bbcode infact i asked here how i can resolve this problem thanks i done $bbc->Parse() I want to display some examples of php on my site. when I discovered that there bbcode parser I look at a guide explaining how to use but not in detail. I wanted to use bbcode but I can not figure out how do I view entire php script code using bbcode . if i pass entire php code to in this way it gives me error and when i try to refresh my web page i see only blank page
    Code:
    bbcode->Parse('if(isset($_POST['logsubmit']) && !isset($_POST['logsubmit']) == false){ 
        $logusername = $_POST['logusername']; 
        $logpassword = $_POST['logpassword'];');

  • #4
    New to the CF scene
    Join Date
    Aug 2013
    Posts
    8
    Thanks
    0
    Thanked 0 Times in 0 Posts
    this is clear i don't know more about bbcode infact i asked here if anyone can help me please .
    this is clear I want to display some examples of php on my site. when I discovered that there bbcode parser I look at a guide explaining how to use but not in detail. I wanted to use bbcode but I can not figure out how do I view entire php script code.
    if i pass php entire code to $bbC->Parse() in this way it gives my many error and when i refresh my web page i see only blank page
    Code:
    bbcode->Parse('if(isset($_POST['logsubmit']) && !isset($_POST['logsubmit']) == false){ 
        $logusername = $_POST['logusername']; 
        $logpassword = $_POST['logpassword'];');

  • #5
    Senior Coder
    Join Date
    Jun 2008
    Location
    New Jersey
    Posts
    2,530
    Thanks
    45
    Thanked 259 Times in 256 Posts
    Like I said, according to your example at the top, you need to wrap the material you send to Parse in PHP tags.

    Code:
    echo $bbC->Parse('<?php echo "hello from php";?>');
    Also, what is !isset($_POST['logsubmit']) == false supposed to do? It will fail if its bank, which is the same as doing isset($_POST['logsubmit'])...


  •  

    Posting Permissions

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