Results 1 to 2 of 2

Thread: simple php formatting question

  1. #1
    Join Date
    Dec 2004
    Posts
    83
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default simple php formatting question

    hey,

    i'm missing something here, can't figure out what. I'm learning php slowly so, I really do appreciate help.

    PHP Code:
    $output "<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"));\n"; 

    What I'm trying to do is put this Analytics code:

    Code:
    <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"));>


    Into $output = " "

    Thanks guys,
    viktor

  2. #2
    Join Date
    Jan 2008
    Posts
    4,168
    Thanks
    28
    Thanked 628 Times in 624 Posts
    Blog Entries
    1

    Default

    This should work for you:
    PHP Code:
    $output = <<< OUT 
    <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"));n
    OUT

    Jeremy | jfein.net

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •