Another PHP include question

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Wachtmeister
    Member
    • Apr 2004
    • 91
    • 3.6.x

    Another PHP include question

    Hello,

    i need to add this to my templates:

    <?php
    define("_BBC_PAGE_NAME", "Forum");
    define("_BBCLONE_DIR", "/home/www/htdocs/WEBGURUS/stats/");
    define("COUNTER", _BBCLONE_DIR."mark_page.php");
    if (is_readable(COUNTER)) include_once(COUNTER);
    ?>

    I cannot get it run in phpinclude_start or phpinclude_end.

    Can someone help me and give the example?

    Regards, Wachtmeister
    Stromspar-Suchmaschine
    Theken & Tresen


  • Jake Bunce
    Senior Member
    • Dec 2000
    • 46598
    • 3.6.x

    #2
    The code looks valid. Is it giving you an error? Or is it not doing what it is supposed to do? What does /home/www/htdocs/WEBGURUS/stats/mark_page.php do?

    Do you want to capture output from that file? If so, use something like this in your phpinclude_start template:

    PHP Code:
    ob_start();
    require(
    "mark_page.php");
    $output ob_get_contents();
    ob_end_clean(); 
    Now you can use $output in your other templates to display the output of the file.

    Comment

    • Wachtmeister
      Member
      • Apr 2004
      • 91
      • 3.6.x

      #3
      This code is a logging and statistic logger. It writes data to a dir, that can be viewed graphical later.

      Where exactly do i add this code? To "phpinclude_php"? The whole thing with <?php .... ?> before and after?

      I tried several things (with <? .. ?>, without <? .. ?>, in phpinclude_start, in phpinclude_end) and the only thing i got, was an error, that the file "" could not be found. But all files are there! Other pages (static php pages) have the same code and it runs.

      Thanks in advance.
      Stromspar-Suchmaschine
      Theken & Tresen


      Comment

      • Wachtmeister
        Member
        • Apr 2004
        • 91
        • 3.6.x

        #4
        short statement from the programmer of this logging tool:


        Oh I've heard about it, though I'm not using it. It seems you put the code snippet into a function of that software. But once this happens BBClone can't no longer read its configuration data because inside of a function global variables aren't available unless you make them global (or you explicitly call the $GLOBALS array).

        You can see it on the message you get. There's the file- / directory name missing, and if you would allow notices to appear on the page you'd get some of them stating undefined variables. Solution would be to put the snippet at a different location, so it's available in global space again.


        Any solution?
        Stromspar-Suchmaschine
        Theken & Tresen


        Comment

        • Jake Bunce
          Senior Member
          • Dec 2000
          • 46598
          • 3.6.x

          #5
          The <?php ?> tags are not required.

          You will have to ask the author of the script for help with this since the problem is with the script itself.

          Comment

          • tankaya61
            New Member
            • Dec 2006
            • 4

            #6
            3.6.4 haven't phpinclude_php

            where i can add this code.
            it should be exist all page
            for example header or footer


            Code:
             
            <?php
            define("_BBC_PAGE_NAME", "turkishboard");  
             define("_BBCLONE_DIR", "istatislik/");  
             define("COUNTER", _BBCLONE_DIR."mark_page.php");  
             if (is_readable(COUNTER)) include_once(COUNTER);
            ?>
            http://www.turkishboard.net

            Comment

            • Zachery
              Former vBulletin Support
              • Jul 2002
              • 59097

              #7
              Dont use the php tags, you are already in the php enviromenty. Just add that code to the global_start plugin in the Plugin Manager

              Comment

              • tankaya61
                New Member
                • Dec 2006
                • 4

                #8
                thanks Zachery i try
                http://www.turkishboard.net

                Comment

                • tankaya61
                  New Member
                  • Dec 2006
                  • 4

                  #9
                  can you check code please
                  is it true title code?
                  there are problem on title code!

                  Code:
                  [FONT=Courier New][COLOR=#0000bb]define[/COLOR][COLOR=#007700]([/COLOR][COLOR=#dd0000]"_BBC_PAGE_NAME"[/COLOR][COLOR=#007700], [/COLOR][COLOR=#dd0000]"$vboptions[bbtitle]"[/COLOR][/FONT][FONT=Courier New][COLOR=#007700]); 
                  [/COLOR][COLOR=#0000bb]define[/COLOR][COLOR=#007700]([/COLOR][COLOR=#dd0000]"_BBCLONE_DIR"[/COLOR][COLOR=#007700], [/COLOR][COLOR=#dd0000]"bbclone/"[/COLOR][/FONT][FONT=Courier New][COLOR=#007700]); 
                  [/COLOR][COLOR=#0000bb]define[/COLOR][COLOR=#007700]([/COLOR][COLOR=#dd0000]"COUNTER"[/COLOR][COLOR=#007700], [/COLOR][COLOR=#0000bb]_BBCLONE_DIR[/COLOR][COLOR=#007700].[/COLOR][COLOR=#dd0000]"mark_page.php"[/COLOR][/FONT][FONT=Courier New][COLOR=#007700]); 
                  if ([/COLOR][COLOR=#0000bb]is_readable[/COLOR][COLOR=#007700]([/COLOR][COLOR=#0000bb]COUNTER[/COLOR][COLOR=#007700])) include_once([/COLOR][COLOR=#0000bb]COUNTER[/COLOR][COLOR=#007700]); [/COLOR][/FONT]
                  http://www.turkishboard.net

                  Comment

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