Results 1 to 2 of 2

Thread: global keyword ignored

  1. #1
    Join Date
    Nov 2007
    Posts
    1

    Default global keyword ignored

    If i create a php_page pointing to a file with the following, there is no output. This works fine on CMPS v2.2.1 (vB 3.6) Any advice?

    PHP Code:
    <?php
    $test 
    "TEST!";
    function 
    Test()
    {
            global 
    $test;
            echo 
    $test;
    }
    Test();

    ?>

  2. #2
    Join Date
    Jan 2004
    Location
    Georgia, USA
    Posts
    34,466

    Default Re: global keyword ignored

    That is a known issue that can occur since the code is processed within a function. You should be able to correct that by looking in your includes/vba_cmps_include_top.php file for this code:
    PHP Code:
                                case 'php_file':
                                    
    ob_start();
                                    require(
    $pages['template']);
                                    
    $home[$modid]['content'] = ob_get_contents();
                                    
    ob_end_clean();
                                break; 
    Replace with this:
    PHP Code:
                                case 'php_file':

                                    
    // Processed outside of the function now

                                
    break; 

    Then look in your includes/vba_cmps_include_bottom.php file and add this code at the end, just before the closing ?> tag:
    PHP Code:
    // Process PHP file pages here to avoid having to globalize variables
    if ($pages['type'] == 'php_file' AND $vba_cusmodid)
    {
        
    ob_start();
        require(
    $pages['template']);
        
    $home[$vba_cusmodid]['content'] = ob_get_contents();
        
    ob_end_clean();


Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. How do I make keyword cloud module?
    By osousous in forum Module & Modification Discussion & Requests
    Replies: 16
    Last Post: 04-29-2008, 01:24 AM
  2. Error of Keyword searching....V2.0.1
    By nostalgia in forum Bugs From 2.0.1
    Replies: 5
    Last Post: 03-05-2007, 04:58 PM
  3. Search by clicking on keyword is broken..
    By Torqued in forum Troubleshooting & Problems
    Replies: 6
    Last Post: 04-10-2006, 11:14 PM
  4. Keyword Links
    By reefland in forum Bugs From 1.0.1
    Replies: 2
    Last Post: 10-25-2005, 05:48 PM
  5. Problem with keyword links
    By kittymother in forum Bugs From 1.0 RC2
    Replies: 2
    Last Post: 07-08-2004, 09:32 PM

Posting Permissions

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