Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

PHP Forum


You are currently viewing our PHP Forum as a guest. Please register to participate.
Login



Freelance Jobs

Reply
Old 05-16-2009, 06:48 PM Google Analytics
konetch's Avatar
Ultra Talker

Posts: 258
Trades: 0
I have a simple flat file database forum and I want to add analytics to the footer.php file.

I added this code to the footer.php file.

PHP Code:
<?php 
    
// Ultimate PHP Board 
    // Author: Tim Hoeppner aka RR_Pilot, FixITguy 
    // Website: http://www.myupb.com 
     

// Version: 2.0 
    // Using textdb Version: 4.3.2 
    //Ending of center Table 
    
if (!defined('DB_DIR')) die 

(
'This must be run under a wrapper script!'); 
    if (!isset(
$script_end_time)) { 
        
$mt explode(' ',  

microtime()); 
        
$script_end_time $mt[0] + $mt[1]; 
    } 
    echo 

    <div class='copy'><a  

href='http://forum.myupb.com/'>Powered by myUPB v"
.UPB_VERSION."</a>&nbsp;&nbsp;&middot;&nbsp;&nbsp; 
    &copy;  

PHP Outburst 2002 - "
.date("Y",time())."</div> 
</div> 





<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"> 
try { 
var pageTracker = _gat._getTracker('UA-8286345-1'); 
pageTracker._trackPageview(); 
} catch(err) {}</script> 


</body> 
</html>"; 
?>
However, whenever I add this to the code I get the error

Parse error: syntax error, unexpected T_STRING, expecting ',' or ';' in /usr/local/httpd/www.konetchreport.com/forum/includes/footer.php on line 23

I don't know how to fix it. I trid romoving all the double quotes and replace them with single quotes, and that usually fixes it, but it doesn't in this case.

What should I do?

Thanks
__________________
Alex
konetch is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Old 05-16-2009, 07:58 PM Re: Google Analytics
mgraphic's Avatar
Truth Seeker

Latest Blog Post:
JAMISONTUNES
Posts: 2,918
Name: Keith Marshall
Location: Connecticut
Trades: 0
You don't want to output your html string like that, it will cause syntax errors.

PHP Code:
<?php 
    
// Ultimate PHP Board 
    // Author: Tim Hoeppner aka RR_Pilot, FixITguy 
    // Website: http://www.myupb.com 
     
// Version: 2.0 
    // Using textdb Version: 4.3.2 
    //Ending of center Table 
    
if (!defined('DB_DIR')) die 
(
'This must be run under a wrapper script!'); 
    if (!isset(
$script_end_time)) { 
        
$mt explode(' ',  
microtime()); 
        
$script_end_time $mt[0] + $mt[1]; 
    } 
?>
    <div class='copy'><a  
href='http://forum.myupb.com/'>Powered by myUPB v<?php echo UPB_VERSION?></a>&nbsp;&nbsp;&middot;&nbsp;&nbsp; 
    &copy;  
PHP Outburst 2002 - <?php echo date("Y",time()); ?></div> 
</div> 
 
 
<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"> 
try { 
var pageTracker = _gat._getTracker('UA-8286345-1'); 
pageTracker._trackPageview(); 
} catch(err) {}</script> 

</body> 
</html>
__________________

<mgraphic /> - I don't have a solution but I admire the problem.
mgraphic is offline
Reply With Quote
View Public Profile
 
Old 05-16-2009, 09:36 PM Re: Google Analytics
konetch's Avatar
Ultra Talker

Posts: 258
Trades: 0
Thanks for the help.
__________________
Alex
konetch is offline
Reply With Quote
View Public Profile
 
Old 05-17-2009, 09:19 AM Re: Google Analytics
Skilled Talker

Posts: 84
Trades: 0
You can not include html code as it is inside <?php .... ?> tags
__________________

Please login or register to view this content. Registration is FREE
-
Please login or register to view this content. Registration is FREE
- 1-888-869-HOST(4678)
Award winning Managed Hosting -
Please login or register to view this content. Registration is FREE

Managed Dedicated Servers. Reseller Discounts. 24/7 Impressive Tech Support
HivelocityDD is offline
Reply With Quote
View Public Profile
 
Reply     « Reply to Google Analytics
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.18861 seconds with 12 queries