vb3 and php question

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • jluerken
    Senior Member
    • Jul 2003
    • 494
    • 4.2.X

    vb3 and php question

    Hi,

    I am using an own small .php script to create an extra page using the vbulletin header, navbar, footer etc.

    Its called cfn_ircstats.php and looking like this:
    PHP Code:
    <?php

    // ####################### SET PHP ENVIRONMENT ###########################
    error_reporting(E_ALL & ~E_NOTICE);

    // #################### DEFINE IMPORTANT CONSTANTS #######################
    define('NO_REGISTER_GLOBALS'1);
    define('THIS_SCRIPT''custom_ircstats.php'); // change this depending on your filename

    // ################### PRE-CACHE TEMPLATES AND DATA ######################
    // get special phrase groups
    $phrasegroups = array(

    );

    // get special data templates from the datastore
    $specialtemplates = array(

    );

    // pre-cache templates used by all actions
    $globaltemplates = array(
        
    'IRCStats',
    );

    // pre-cache templates used by specific actions
    $actiontemplates = array(

    );

    // ######################### REQUIRE BACK-END ############################
    require_once('./global.php');

    // #######################################################################
    // ######################## START MAIN SCRIPT ############################
    // #######################################################################

    $navbits = array();
    $navbits[$parent] = 'IRC Stats';

    $navbits construct_navbits($navbits);
    eval(
    '$navbar = "' fetch_template('navbar') . '";');
    eval(
    'print_output("' fetch_template('IRCStats') . '");');

    ?>
    Now I create a Template called IRCStats with the content
    which is looking like this:

    HTML Code:
    $stylevar[htmldoctype]
    <html dir="$stylevar[textdirection]" lang="$stylevar[languagecode]">
    <head>
    <title>$vboptions[bbtitle]</title>
    $headinclude
    </head>
    <body>
    $header
    
    $navbar
    
    <table class="tborder" cellpadding="$stylevar[cellpadding]" cellspacing="$stylevar[cellspacing]" border="0" width="100%" align="center">
    <tr>
    <td class="alt1">
         
    <table cellSpacing="0" cellPadding="0" width="100%" border="0" id="table1">
                  <tr>
                    <td class="alt2"><p align="center"><b><font size="4" face="Verdana">IRC Stats</font></b></p></td></tr>
    <tr>
    <td>
    $ircstatsdata
    </td>
    </tr>
    
    </table>
    
    </td>
    </tr>
    </table>
    
    $footer
    </body>
    </html>
    A demo can be found here: http://www.clanforums.com/forum/cfn_ircstats.php

    You see that the external file is being called, showing the template and everything is fine.

    Now to the problem:
    In the template where $ircstatsdata is standing should be text coming from an external page.
    I am trying since hours now to get this working.

    If I use the from phpinclude_start
    PHP Code:
    ob_start();
    require(
    "http://www.clanforums.com/forum/cfn_ircstats.pisg");
    $ircstatsdata ob_get_contents();
    ob_end_clean(); 
    everything is fine but means that the file is called everytime the forum loads which is really bad.
    I want to tell the file cfn_ircstats.php to read cfn_ircstats.pisg and to write the content to the variable $ircstatsdata.
    This will improve the whole thing cause only if the page is called the content is read.
    Server load will be very low for this.

    I kwow that this is a half a question regarding php and half vb3 but as you know both you maybe have an easy solution for me cause I have now clue regarding php and who the variables are working inside of vb3.

    Would be nice if you could help me!

    Kind regards
    jluerken
    Last edited by jluerken; Wed 25 Aug '04, 11:01pm. Reason: Update: Wrong link
  • jluerken
    Senior Member
    • Jul 2003
    • 494
    • 4.2.X

    #2
    I found the problem after a night of sleep

    I read the variable after I did the output which is wrong for sure

    Correct is this:

    PHP Code:
    <?php

    // ####################### SET PHP ENVIRONMENT ###########################
    error_reporting(E_ALL & ~E_NOTICE);

    // #################### DEFINE IMPORTANT CONSTANTS #######################
    define('NO_REGISTER_GLOBALS'1);
    define('THIS_SCRIPT''custom_ircstats.php'); // change this depending on your filename

    // ################### PRE-CACHE TEMPLATES AND DATA ######################
    // get special phrase groups
    $phrasegroups = array(

    );

    // get special data templates from the datastore
    $specialtemplates = array(

    );

    // pre-cache templates used by all actions
    $globaltemplates = array(
        
    'IRCStats',
    );

    // pre-cache templates used by specific actions
    $actiontemplates = array(

    );

    // ######################### REQUIRE BACK-END ############################
    require_once('./global.php');

    // #######################################################################
    // ######################## START MAIN SCRIPT ############################
    // #######################################################################

    $navbits = array();
    $navbits[$parent] = 'IRC Stats';

    $navbits construct_navbits($navbits);

    // get irc data
    $ircstatsdata implode(''file('http://www.clanforums.com/forum/cfn_ircstats.pisg'));

    eval(
    '$navbar = "' fetch_template('navbar') . '";');
    eval(
    'print_output("' fetch_template('IRCStats') . '");');

    ?>
    No I have to do some .css and HTML Output changes and have a fully in vb3 integrated IRC Statstool for free

    Maybe I create a hack out of this!

    Comment

    • lkthinh
      New Member
      • Aug 2004
      • 1
      • 3.0.1

      #3
      that's a good try, man I'm trying too, for my forum.

      Comment

      • lieutan
        New Member
        • Sep 2002
        • 6
        • 4.2.X

        #4
        I am trying to do the same thing with Legond Of The Green Dragon

        I would like to be able to do the same thing with a game called legen of the green dragon..

        It is an external .php ran game.. I would do anything to have the game run inside of VB with the header and footer as you have with irc stats...

        can you help me on how to have it run with vb's head and footer..

        to take a look at my site and the game if you need to it is

        Choosing the right domain name can be overwhelming. Our personalized customer service helps you get a great domain.


        look on the navbar where it says Legond Of the Green Dragon and click there.. you do not have to be registered to view what you need..

        thanks... Oh and if someone can help me accomplish i will gladly pay them 20.00 through paypal for there help....

        thanks

        Comment

        widgetinstance 262 (Related Topics) skipped due to lack of content & hide_module_if_empty option.
        Working...