By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
437,614 Members | 1,653 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 437,614 IT Pros & Developers. It's quick & easy.

Problems With Refer Script

P: n/a
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($_SERVER['SCRIPT_FILENAME']) ?>/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.
Jul 16 '05 #1
Share this Question
Share on Google+
2 Replies


P: n/a
The line is not correct:

<?php include '<?php echo dirname($_SERVER['SCRIPT_FILENAME'])
?>/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($_SERVER['SCRIPT_FILENAME'])>;
$location = "$location".'/refer.php' ;
include "$location" ;
?>

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

--
Blaine Hilton
http://www.webcalc.net/
On Sun, 03 Aug 2003 06:17:14 GMT, "Mike" <no****@nospam.com> wrote:
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($_SERVER['SCRIPT_FILENAME']) ?>/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.


Jul 16 '05 #2

P: n/a
> <?php
// Untested, use with caution
$location = dirname($_SERVER['SCRIPT_FILENAME'])>;
$location = "$location".'/refer.php' ;
include "$location" ;
?>


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

This discussion thread is closed

Replies have been disabled for this discussion.