Hello and welcome to our community! Is this your first visit?
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3
  1. #1
    Regular Coder
    Join Date
    Feb 2005
    Thanked 14 Times in 14 Posts

    function is always called first?

    I'm working with a set of php5 scripts, trying to modify it to work with a separate chat script. But for some strange (or not strange) reason, the code for the chat is always loaded first when viewing the page. It even loads before any of the header information.

    Would this be something related to php5 in general or something else?

    The below function is part of a larger php class
    PHP Code:
    public function show($info "")
    $do "show_games";
    $do "show_".$_GET['do'];
    $_GET['do'] == "search")
    $do "show_games";
            <TABLE WIDTH=\"100%\">
                    <TD text-align\"left\">
                            <TD valign=\"top\">Put something Here</TD>
                    <TD valign=\"top\" text-align\"right\">This will be the Right Side blocks</TD>
    In the above, I've modified it to include the chat_shoutbox() function. The chat/shoutbox is loaded, but is always the first thing at the top of the page. I've gone as far as making the shoutbox function a simple echo statement, and it still loads first before anything else.

  • #2
    Senior Coder
    Join Date
    May 2005
    Thanked 72 Times in 72 Posts
    What I believe it is, is your using your ELSE statement too early. Maybe change to ELSEIF and adding ELSE down more. Because it should be like,

    >start chat here

    >end chat here

    (if chat not started)

    Do this.

  • #3
    Regular Coder
    Join Date
    Mar 2005
    D0u$h!t3 k4?
    Thanked 5 Times in 5 Posts
    When is this function called? If it is called inside a constructor that you use, then the function will be called, and I'm guessing that show_output() will output the string stored in the 'output' member of your class. Without some info about your class and where you create an instance of the class, I can't see any problems.
    PHP Code:
    $hello file_get_contents('hello.txt'); echo $hello


    Posting Permissions

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