Problems With Refer Script

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Mike

    Problems With Refer Script

    I've been trying to setup Dean Allen's excellent "Refer" script.
    (http://www.textism.com/tools/refer/)

    The instructions say to add this code to the bottom of whatever web pages
    you want the refer script to track (after the closing </html> tag):

    <?php include '<?php echo dirname($_SERVE R['SCRIPT_FILENAM E']) ?>/refer.php'
    ?>

    Doing so results in the following error on any pages that have the
    aforementioned code:

    Parse error: parse error in /home/username/public_html/page.php on line 63

    The offending line is always the line with the aforementioned PHP code. Does
    anyone have any idea what might be causing this not to work? I installed the
    refer script into the /refer directory in the web root of my server.

    Any help is greatly appreciated.


  • Blaine HIlton

    #2
    Re: Problems With Refer Script

    The line is not correct:

    <?php include '<?php echo dirname($_SERVE R['SCRIPT_FILENAM E'])
    ?>/refer.php'
    ?>

    is not valid. You can not have a <?php and then another <?php. I'm
    not sure what you are trying to do, but you probably need something
    more like:

    <?php
    // Untested, use with caution
    $location = dirname($_SERVE R['SCRIPT_FILENAM E'])>;
    $location = "$location" .'/refer.php' ;
    include "$location" ;
    ?>

    You may want to try reading the manual also...

    --
    Blaine Hilton



    On Sun, 03 Aug 2003 06:17:14 GMT, "Mike" <nospam@nospam. com> wrote:
    [color=blue]
    >I've been trying to setup Dean Allen's excellent "Refer" script.
    >(http://www.textism.com/tools/refer/)
    >
    >The instructions say to add this code to the bottom of whatever web pages
    >you want the refer script to track (after the closing </html> tag):
    >
    ><?php include '<?php echo dirname($_SERVE R['SCRIPT_FILENAM E']) ?>/refer.php'
    >?>
    >
    >Doing so results in the following error on any pages that have the
    >aforemention ed code:
    >
    > Parse error: parse error in /home/username/public_html/page.php on line 63
    >
    >The offending line is always the line with the aforementioned PHP code. Does
    >anyone have any idea what might be causing this not to work? I installed the
    >refer script into the /refer directory in the web root of my server.
    >
    >Any help is greatly appreciated.
    >[/color]

    Comment

    • Martin Wallgren

      #3
      Re: Problems With Refer Script

      > <?php[color=blue]
      > // Untested, use with caution
      > $location = dirname($_SERVE R['SCRIPT_FILENAM E'])>;
      > $location = "$location" .'/refer.php' ;
      > include "$location" ;
      > ?>[/color]

      A much shorter version that doesn't depend on temporary variables:
      <?php include(dirname ($_SERVER['SCRIPT_FILENAM E']) . '/refer.php'); ?>
      ---
      Martin Wallgren

      Comment

      Working...