1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

unable to put adsense in customfunctions.php

Discussion in 'PHP & Perl' started by oblivion19, Aug 27, 2011.

Tags:
  1. oblivion19

    oblivion19 Senior Member

    Joined:
    Aug 24, 2009
    Messages:
    841
    Likes Received:
    387
    Hey all,

    Would appreciate some help here. I have no knowledge or experience in coding.

    I am trying to put my ad-sense code in functions.php file so it could show up below my title in each post.

    The theme im using is thesis 1.6

    I googled and saw how to do it on various blogs. However, whenever, im copy pasting the code at the end of document and saving it, the website wont work and give error along the lines of some kind of parsing error at line...

    I dont really know what im doing wrong.Im copy pasting the exact stuff!

    I am doing this in my cpanel....
     
    Last edited: Aug 27, 2011
  2. Autumn

    Autumn Elite Member

    Joined:
    Nov 18, 2010
    Messages:
    2,197
    Likes Received:
    3,041
    Occupation:
    I figure out ways to make money online and then au
    Location:
    Spamville
    You will need to escape either the single or double quotes within your Adsense code (depending on whether you are using a single or double quote around your variables in your function) with a backslash eg.

    Code:
    $var = "<script=\"script_name.js\">";
    
    or maybe
    
    $var = '<script=\'script_name.js\'>';
    
    
    Post the function you're trying to use to display your Adsense plus the precise error messages for more feedback. You have to be specific when you ask coding questions.
     
  3. ShiftySituation

    ShiftySituation Power Member

    Joined:
    Apr 15, 2010
    Messages:
    621
    Likes Received:
    314
    Occupation:
    Having fun
    Location:
    Jacksonville, FL
    if you are putting it inside of a php function, you'll need to echo the entire script code.

    echo "<script= this is all of the code and any " need to have a \ before it, so \" would be proper and then at the end of the code just close it with a ";

    This will echo the JavaScript code inside of the html and adsense will show.
     
  4. TheSomeone

    TheSomeone Newbie

    Joined:
    Jul 25, 2011
    Messages:
    22
    Likes Received:
    8
    Show us example of modified php file that You made, then we'll can help You.
     
  5. oblivion19

    oblivion19 Senior Member

    Joined:
    Aug 24, 2009
    Messages:
    841
    Likes Received:
    387
    uncguy4321 helped me out over skype and fixed the prob.. tx a lot dude..