T_string problem

Discussion in 'PHP' started by Xphic, Dec 15, 2007.

  1. #1
    whats going on :confused:

    http://imgtags.com/
    its on the main page

    <?
    print "<div id='banner'><script type="text/javascript"><!--
    google_ad_client = "pub-2435134404576417";
    //468x60, created 12/15/07
    google_ad_slot = "1019639685";
    google_ad_width = 468;
    google_ad_height = 60;
    //--></script>
    <script type="text/javascript"
    src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
    </script></div>";
    ?>
    PHP:
    Thats whats in the ad.php
     
    Xphic, Dec 15, 2007 IP
  2. YIAM

    YIAM Notable Member

    Messages:
    2,480
    Likes Received:
    240
    Best Answers:
    0
    Trophy Points:
    280
    #2
    remove the php code part.

    <div id="banner"><script type="text/javascript"><!--
    google_ad_client = "pub-2435134404576417";
    //468x60, created 12/15/07
    google_ad_slot = "1019639685";
    google_ad_width = 468;
    google_ad_height = 60;
    //--></script>
    <script type="text/javascript"
    src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
    </script></div>
    
    HTML:
     
    YIAM, Dec 15, 2007 IP
  3. Xphic

    Xphic Active Member

    Messages:
    1,323
    Likes Received:
    20
    Best Answers:
    0
    Trophy Points:
    80
    #3
    worked great, thank you :)
     
    Xphic, Dec 15, 2007 IP
  4. InFloW

    InFloW Peon

    Messages:
    1,488
    Likes Received:
    39
    Best Answers:
    0
    Trophy Points:
    0
    #4
    Just so you know what was going on here the problem was the fact that your code has quotes in it.

    When you do

    
    print "HERE IS MY STRING";
    
    PHP:
    Anything with " will cause it to believe that this is the end of the statement. The way to solve this is to use an escape character so it would become \" at every quote that you do not want to end the string.

    Of course in this case it's easier to just have the HTML there as someone suggested.
     
    InFloW, Dec 15, 2007 IP
  5. Xphic

    Xphic Active Member

    Messages:
    1,323
    Likes Received:
    20
    Best Answers:
    0
    Trophy Points:
    80
    #5
    oh, okay thanks for the info InFlow
     
    Xphic, Dec 15, 2007 IP
  6. Barti1987

    Barti1987 Well-Known Member

    Messages:
    2,703
    Likes Received:
    115
    Best Answers:
    0
    Trophy Points:
    185
    #6
    Your copyrights aren't appearing.

    You also have a "Haha" in your page!

    Peace,
     
    Barti1987, Dec 15, 2007 IP
  7. Kaizoku

    Kaizoku Well-Known Member

    Messages:
    1,261
    Likes Received:
    20
    Best Answers:
    1
    Trophy Points:
    105
    #7
    You need to escape the quotes if going to process it by php, also use echo, it is better.
    
    <?php
    echo "<div id='banner'><script type=\"text/javascript\"><!--
    google_ad_client = \"pub-2435134404576417\";
    //468x60, created 12/15/07
    google_ad_slot = \"1019639685\";
    google_ad_width = 468;
    google_ad_height = 60;
    //--></script>
    <script type=\"text/javascript\"
    src=\"http://pagead2.googlesyndication.com/pagead/show_ads.js\">
    </script></div>";
    ?>
    
    PHP:
     
    Kaizoku, Dec 15, 2007 IP