| | |
Newby to PHP here.... (Google Analytics)
Please support our PHP advertiser: PostgreSQL or MySQL? Compare and contrast the two most popular open source databases
![]() |
•
•
Join Date: Jan 2008
Posts: 9
Reputation:
Solved Threads: 0
RE:Google Analitcs
Hi gang,
I'm new to PHP... as you will probably be able to easily recognize by my following dialog. ;-)
Anyway... I am taking over a website written in PHP with dreamweaver CS3.
It has a seperate footer.php file in a sub directory
and I believe this makes it a dynamic site? Am I wrong?
It appears Google provides two codes for google analytics tracking. Static and dynamic
http://www.google.com/support/analyt...n&answer=55504
Utilizing the the dynamic code..... I get this error at the bottom of my pages.
Parse error: parse error, unexpected T_STRING, expecting ',' or ';' in /home/content/B/r/1/Hidden/html/-APPI-/NAV/footer.php on line 26
HELP.... :-(
Footer.php looks like this (located in a subdirectory)
************************
<?php
echo "
<br />
</td>
</tr>
<tr>
<td align=\"right\" ></td>
<td align=\"right\" valign=\"top\">
<table style=\"margin-left:15px;border-style:solid;border-width:2px;border-color:#000000\" width=\"580\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\" bgcolor=\"336699\" height=\"20\" bordercolor=\"#000000\">
<tr>
<td>
<div align=\"center\"><font color=\"#FFFFFF\" face=\"Verdana, Arial, Helvetica, sans-serif\" size=\"1\">©
Allied Power Products, Inc.</font></div>
</td>
</tr>
</table>
<div align=\"center\"><font face=\"Verdana, Arial, Helvetica, sans-serif\" size=\"1\"><b><br>
CAUTION:</b> The final determination as to the suitability of<br>
this product for any purpose is solely that of the user.<br>
Our products are not to be used to lift or move<br>
people or to lift anything over people.</font></div>
</td>
</tr>
<?php
$virtual_page = "Main_Page"
include_once "analyticstracking.php" ?>"
</body>
</html>
";
?>
Analytics.php looks like this
************************
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
</head>
<body>
<script type="text/javascript">
var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www.");
document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E"));
</script>
<script type="text/javascript">
var pageTracker = _gat._getTracker("UA-500580");
pageTracker._trackPageview('');
</script>
<?php
// End Analytics tracking code
?>
</body>
</html>
Hi gang,
I'm new to PHP... as you will probably be able to easily recognize by my following dialog. ;-)
Anyway... I am taking over a website written in PHP with dreamweaver CS3.
It has a seperate footer.php file in a sub directory
and I believe this makes it a dynamic site? Am I wrong?
It appears Google provides two codes for google analytics tracking. Static and dynamic
http://www.google.com/support/analyt...n&answer=55504
Utilizing the the dynamic code..... I get this error at the bottom of my pages.
Parse error: parse error, unexpected T_STRING, expecting ',' or ';' in /home/content/B/r/1/Hidden/html/-APPI-/NAV/footer.php on line 26
HELP.... :-(
Footer.php looks like this (located in a subdirectory)
************************
<?php
echo "
<br />
</td>
</tr>
<tr>
<td align=\"right\" ></td>
<td align=\"right\" valign=\"top\">
<table style=\"margin-left:15px;border-style:solid;border-width:2px;border-color:#000000\" width=\"580\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\" bgcolor=\"336699\" height=\"20\" bordercolor=\"#000000\">
<tr>
<td>
<div align=\"center\"><font color=\"#FFFFFF\" face=\"Verdana, Arial, Helvetica, sans-serif\" size=\"1\">©
Allied Power Products, Inc.</font></div>
</td>
</tr>
</table>
<div align=\"center\"><font face=\"Verdana, Arial, Helvetica, sans-serif\" size=\"1\"><b><br>
CAUTION:</b> The final determination as to the suitability of<br>
this product for any purpose is solely that of the user.<br>
Our products are not to be used to lift or move<br>
people or to lift anything over people.</font></div>
</td>
</tr>
<?php
$virtual_page = "Main_Page"
include_once "analyticstracking.php" ?>"
</body>
</html>
";
?>
Analytics.php looks like this
************************
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
</head>
<body>
<script type="text/javascript">
var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www.");
document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E"));
</script>
<script type="text/javascript">
var pageTracker = _gat._getTracker("UA-500580");
pageTracker._trackPageview('');
</script>
<?php
// End Analytics tracking code
?>
</body>
</html>
Actually, its not $virtual_page="Main_Page". Its because, You have opened the double quote and you are closing it at the end. (after </html>). And you are having a php tag within a php tag !
This will probably do.
php Syntax (Toggle Plain Text)
<?php echo " <br /> </td> </tr> <tr> <td align=\"right\" ></td> <td align=\"right\" valign=\"top\"> <table style=\"margin-left:15px;border-style:solid;border-width:2px;border-color:#000000\" width=\"580\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\" bgcolor=\"336699\" height=\"20\" bordercolor=\"#000000\"> <tr> <td> <div align=\"center\"><font color=\"#FFFFFF\" face=\"Verdana, Arial, Helvetica, sans-serif\" size=\"1\">© Allied Power Products, Inc.</font></div> </td> </tr> </table> <div align=\"center\"><font face=\"Verdana, Arial, Helvetica, sans-serif\" size=\"1\"><b><br> CAUTION:</b> The final determination as to the suitability of<br> this product for any purpose is solely that of the user.<br> Our products are not to be used to lift or move<br> people or to lift anything over people.</font></div> </td> </tr>"; <?php $virtual_page = "Main_Page"; include_once "analyticstracking.php"; echo "</body> </html>"; ?>
Ignorance is definitely not bliss!
*PM asking for help will be ignored*
*PM asking for help will be ignored*
And what is in allied_footer.php ?
Dang. I did a stupid mistake.
Check now.
Dang. I did a stupid mistake.
php Syntax (Toggle Plain Text)
<?php echo " <br /> </td> </tr> <tr> <td align=\"right\" ></td> <td align=\"right\" valign=\"top\"> <table style=\"margin-left:15px;border-style:solid;border-width:2px;border-color:#000000\" width=\"580\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\" bgcolor=\"336699\" height=\"20\" bordercolor=\"#000000\"> <tr> <td> <div align=\"center\"><font color=\"#FFFFFF\" face=\"Verdana, Arial, Helvetica, sans-serif\" size=\"1\">© Allied Power Products, Inc.</font></div> </td> </tr> </table> <div align=\"center\"><font face=\"Verdana, Arial, Helvetica, sans-serif\" size=\"1\"><b><br> CAUTION:</b> The final determination as to the suitability of<br> this product for any purpose is solely that of the user.<br> Our products are not to be used to lift or move<br> people or to lift anything over people.</font></div> </td> </tr>"; $virtual_page = "Main_Page"; include_once "analyticstracking.php"; echo "</body> </html>"; ?>
Check now.
Last edited by nav33n; Jan 31st, 2008 at 3:01 pm.
Ignorance is definitely not bliss!
*PM asking for help will be ignored*
*PM asking for help will be ignored*
•
•
Join Date: Jan 2008
Posts: 9
Reputation:
Solved Threads: 0
I do appreciate your work.... Still seem to be getting this same funny error.
Parse error: parse error, unexpected '?' in /home/content/B/r/1/Hidden/html/-APPI-/NAV/allied_footer.php on line 25
FYI... allied_footer.php is the actual name of the footer file. I just referred to it as footer.php earlier to reduce confusion. I will stick with calling it allied_footer.php from now on.
Keep in mind, my "allied_footer.php" is in a sub directory. The analyticstracking.php is in the main directory. Let me know if this is an issue. Thank you!
Parse error: parse error, unexpected '?' in /home/content/B/r/1/Hidden/html/-APPI-/NAV/allied_footer.php on line 25
FYI... allied_footer.php is the actual name of the footer file. I just referred to it as footer.php earlier to reduce confusion. I will stick with calling it allied_footer.php from now on.
Keep in mind, my "allied_footer.php" is in a sub directory. The analyticstracking.php is in the main directory. Let me know if this is an issue. Thank you!
•
•
Join Date: Jan 2008
Posts: 9
Reputation:
Solved Threads: 0
Here ya go... (FYI: I hid my tracking ID)
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
</head>
<body>
<script type="text/javascript">
var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www.");
document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E"));
</script>
<script type="text/javascript">
var pageTracker = _gat._getTracker("UA-******");
pageTracker._trackPageview('');
</script>
<?php
// End Analytics tracking code
?>
</body>
</html>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
</head>
<body>
<script type="text/javascript">
var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www.");
document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E"));
</script>
<script type="text/javascript">
var pageTracker = _gat._getTracker("UA-******");
pageTracker._trackPageview('');
</script>
<?php
// End Analytics tracking code
?>
</body>
</html>
![]() |
Other Threads in the PHP Forum
- Previous Thread: PHP Select Statement
- Next Thread: Help on Deleting files from server- no database
| Thread Tools | Search this Thread |
301 access apache api array beginner binary broken button cakephp checkbox class clean cms code countingeverycharactersfromastring crack cron curl database date decode directory display dissertation dropdown dynamic echo email error fairness file files folder form forms function functions google href htaccess html image include insert integration ip javascript joomla limit link login mail match md5 menu methods mlm multiple mysql newsletters oop pageing pagerank paypal pdf php problem protocol query radio random recursion remote script search secure server sessions simple sms soap source space spam sql syntax system table tutorial update upload url validator variable video virus votedown web youtube






