1. Advertising
    y u no do it?

    Advertising (learn more)

    Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

    Starts at just $1 per CPM or $0.10 per CPC.

Need help with adsense in PHP

Discussion in 'Placement / Reviews / Examples' started by daones, May 10, 2007.

  1. #1
    Im trying to insert a 728x15 adsense text link on the submit page of my directory. http://www.fesu.net/submit.php. Right below the continue button. heres the tpl file for the submit page can someone tell me where the adsense code would go?

    {capture name="title"} - {l}Submit Link{/l}{/capture} {capture assign="in_page_title"}{l}Submit
    Link{/l}{/capture} {capture assign="description"}{l}Submit a new link to the directory{/l}{/capture}
    {include file="header.tpl"} {include file="top_bar.tpl"} {strip}
    <table width="746" border="0" align="center" cellpadding="0" cellspacing="3" class="mainbg">
    <tr>
    <td width="177" valign="top">{include file="sidebar.tpl"}</td>
    <td width="560" valign="top">{if $error}
    <table width="100%" align="center">
    <tr>
    <td colspan="2" class="err">{l}An error occured while saving the link.{/l}
    {if !empty($sqlError)}
    <p>{$sqlError}</p>
    {/if} </td>
    </tr>
    </table>
    {/if} {if $posted}
    <table width="100%" align="center">
    <tr>
    <td colspan="2" class="msg">{l}Link submitted and awaiting approval.{/l}&nbsp;&nbsp;{l}Submit another link.{/l}</td>
    </tr>
    </table>
    {/if}
    <table width="100%" border="0" align="center" cellpadding="0" cellspacing="0">
    <tr>
    <td><table width="100%" border="0" align="center" cellpadding="0" cellspacing="0">
    <tr>
    <td><form method="post" action="">
    {if count($price) gt 0}
    <table width="100%" border="0" cellspacing="0" cellpadding="0" class="bars">
    <tr>
    <td>Pricing</td>
    </tr>
    </table>
    <table width="100%" border="0" align="center" cellpadding="2" cellspacing="2" style="margin-top: 10px;">
    {if $price.featured}
    <tr>
    <td width="48%">
    <input type="radio" name="LINK_TYPE" value="featured"{if $LINK_TYPE eq 'featured'} checked="true"{/if} />
    {l}Featured links{/l}</td>
    <td width="42%">${$price.featured}</td>
    </tr>
    {/if} {if $price.normal gt 0}
    <tr>
    <td><input type="radio" name="LINK_TYPE" value="normal"{if $LINK_TYPE eq 'normal'} checked="true"{/if} />
    {l}Regular links{/l}</td>
    <td>${$price.normal}</td>
    </tr>
    {elseif $price.normal eq 0}
    <tr>
    <td><input type="radio" name="LINK_TYPE" value="normal"{if $LINK_TYPE eq 'normal'} checked="true"{/if} />
    {l}Regular links{/l}</td>
    <td>{l}free{/l}</td>
    </tr>
    {/if} {if $price.reciprocal gt 0}
    <tr>
    <td><input type="radio" name="LINK_TYPE" value="reciprocal"{if $LINK_TYPE eq 'reciprocal'} checked="true"{/if} />
    {l}Regular links with reciprocal{/l}</td>
    <td>${$price.reciprocal}</td>
    </tr>
    {elseif $price.reciprocal eq 0}
    <tr>
    <td><input type="radio" name="LINK_TYPE" value="reciprocal"{if $LINK_TYPE eq 'reciprocal'} checked="true"{/if} />
    {l}Regular links with reciprocal{/l}</td>
    <td>{l}free{/l}</td>
    </tr>
    {/if} {if isset($price.free)}
    <tr>
    <td><input type="radio" name="LINK_TYPE" value="free"{if $LINK_TYPE eq 'free'} checked="true"{/if} />
    {l}Links with nofollow attribute{/l}</td>
    <td>free</td>
    </tr>
    {/if}
    </table>
    {validate form="submit_link" id="v_LINK_TYPE" message=$smarty.capture.field_link_type}
    {/if} <br />
    <table width="100%" border="0" cellspacing="0" cellpadding="0" class="bars">
    <tr>
    <td>Submit Link</td>
    </tr>
    </table>
    <table width="100%" border="0" align="center" cellpadding="2" cellspacing="2" style="margin-top: 10px;">
    <tr>
    <td width="100" class="label"><span class='req'>*</span>{l}Title{/l}:</td>
    <td width="400" class="field"> <input type="text" name="TITLE" value="{$TITLE|escape|trim}" size="40" maxlength="255" class="input"/>
    {validate form="submit_link" id="v_TITLE" message=$smarty.capture.field_char_required}
    {validate form="submit_link" id="v_TITLE_U" message=$smarty.capture.title_not_unique}
    </td>
    </tr>
    <tr>
    <td class="label"><span class='req'>*</span>{l}URL{/l}:</td>
    <td class="field"> <input type="text" name="URL" value="{$URL|escape|trim}" size="40" maxlength="255" class="input"/>
    {validate form="submit_link" id="v_URL" message=$smarty.capture.invalid_url}
    {validate form="submit_link" id="v_URL_ONLINE" message=$smarty.capture.url_not_online}
    {validate form="submit_link" id="v_URL_U" message=$smarty.capture.url_not_unique}
    </td>
    </tr>
    <tr>
    <td valign="top" class="label"><span class='req'>*</span>{l}Description{/l}:</td>
    <td class="field"> <textarea name="DESCRIPTION" rows="3" cols="37" class="input">{$DESCRIPTION|escape|trim}</textarea>
    </td>
    </tr>
    <tr>
    <td class="label"><span class='req'>*</span>{l}Name{/l}:</td>
    <td class="field"> <input type="text" name="OWNER_NAME" value="{$OWNER_NAME|escape|trim}" size="30" maxlength="255" class="input" />
    {validate form="submit_link" id="v_OWNER_NAME" message=$smarty.capture.field_char_required}
    </td>
    </tr>
    <tr>
    <td class="label"><span class='req'>*</span>{l}Email{/l}:</td>
    <td class="field"> <input type="text" name="OWNER_EMAIL" value="{$OWNER_EMAIL|escape|trim}" size="30" maxlength="255" class="input" />
    {validate form="submit_link" id="v_OWNER_EMAIL" message=$smarty.capture.invalid_email}
    </td>
    </tr>
    <tr>
    <td class="label"><span class='req'>*</span>{l}Category{/l}:</td>
    <td class="field"> {html_options options=$categs selected=$CATEGORY_ID
    name="CATEGORY_ID"} {validate form="submit_link" id="v_CATEGORY_ID"
    message=$smarty.capture.no_url_in_top} </td>
    </tr>
    <tr>
    <td valign="top" class="label">{if $recpr_required}<span class='req'>*</span>{/if}{l}Reciprocal URL{/l}:</td>
    <td class="field"> <input type="text" name="RECPR_URL" value="{$RECPR_URL|escape|trim}" size="40" maxlength="255" class="input" />
    {validate form="submit_link" id="v_RECPR_URL" message=$smarty.capture.invalid_url}
    {validate form="submit_link" id="v_RECPR_ONLINE" message=$smarty.capture.url_not_online}
    {validate form="submit_link" id="v_RECPR_LINK" message=$smarty.capture.recpr_not_found|replace:'#SITE_URL#':$smarty.const.SITE_URL}
    <br /> <p class="small">{l}To validate the reciprocal
    link please include the<br />
    following HTML code in the page at the URL<br />
    specified above, before submiting this form:{/l}</p>
    <textarea name="RECPR_TEXT" rows="3" readonly="readonly" cols="37" class="input">&lt;a href="{$smarty.const.SITE_URL}"&gt;{$smarty.const.SITE_NAME}&lt;/a&gt;</textarea>
    </td>
    </tr>
    {if $smarty.const.VISUAL_CONFIRM}
    <tr>
    <td valign="top" class="label"><span class='req'>*</span>{l}Enter
    the code shown{/l}:</td>
    <td class="field"> <input type="text" name="CAPTCHA" value="" size="10" maxlength="5" class="input" />
    {validate form="submit_link" id="v_CAPTCHA" message=$smarty.capture.invalid_code}<br />
    <p class="small">{l}This helps prevent automated registrations.{/l}</p>
    <img src="{$smarty.const.DOC_ROOT}/captcha.php" class="captcha" alt="{l}Visual Confirmation Security Code{/l}" title="{l}Visual Confirmation Security Code{/l}" />
    </td>
    </tr>
    {/if}
    <tr>
    <td height="50"></td>
    <td height="50"><input type="submit" name="submit" value="{l}Continue{/l}" class="btn" /></td>
    </tr>
    </table>
    </form></td>
    </tr>
    </table></td>
    </tr>
    </table></td>
    </tr>
    </table>
    {include file="footer.tpl"} {/strip}
     
    daones, May 10, 2007 IP
  2. eddy2099

    eddy2099 Peon

    Messages:
    8,028
    Likes Received:
    568
    Best Answers:
    0
    Trophy Points:
    0
    #2
    The PHP Page is pretty much just a HTML Page with some PHP tags. The Continue button would be the 10th line counting from the bottom up. Just adding the Javascript from Adsense anywhere after the above-stated code would do the trick.

    Something like

    should do the trick
     
    eddy2099, May 10, 2007 IP
  3. daones

    daones Well-Known Member

    Messages:
    1,151
    Likes Received:
    39
    Best Answers:
    0
    Trophy Points:
    120
    #3
    Yes thats where i tried putting it before i posted. I figured thats where it should be but when i save the template the adsense doesnt even show up? But when i view the page source its on there.
     
    daones, May 10, 2007 IP
  4. eddy2099

    eddy2099 Peon

    Messages:
    8,028
    Likes Received:
    568
    Best Answers:
    0
    Trophy Points:
    0
    #4
    If that page is still not indexed, it is possible that no Adsense will show up for the few days.
     
    eddy2099, May 10, 2007 IP
  5. Rasputin

    Rasputin Peon

    Messages:
    1,511
    Likes Received:
    67
    Best Answers:
    0
    Trophy Points:
    0
    #5
    Rasputin, May 10, 2007 IP
  6. hasbehas

    hasbehas Well-Known Member

    Messages:
    726
    Likes Received:
    24
    Best Answers:
    0
    Trophy Points:
    190
    #6
    What does literal do ?
     
    hasbehas, May 10, 2007 IP
  7. daones

    daones Well-Known Member

    Messages:
    1,151
    Likes Received:
    39
    Best Answers:
    0
    Trophy Points:
    120
    #7
    ok ill try those things.. thanks.
     
    daones, May 10, 2007 IP
  8. daones

    daones Well-Known Member

    Messages:
    1,151
    Likes Received:
    39
    Best Answers:
    0
    Trophy Points:
    120
    #8
    Heres the code i input but now as you can see it shows up weird:

    <tr>
    <td height="50"></td>
    <td height="50"><input type="submit" name="submit" value="{l}Continue{/l}" class="btn" />
    <p>{literal}<script type="text/javascript"><!--
    google_ad_client = "";
    google_ad_width = 468;
    google_ad_height = 15;
    google_ad_format = "468x15_0ads_al";
    //2007-05-12: fesusubmit
    google_ad_channel = "0696670757";
    //-->
    </script>
    <script type="text/javascript"
    src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
    </script>{/literal}<BR>
    </td>
    </tr>
    </table>
    </form></td>
    </tr>
    </table></td>
    </tr>
    </table></td>
    </tr>
    </table>
    {include file="footer.tpl"} {/strip}
     
    daones, May 12, 2007 IP
  9. ashishmohta

    ashishmohta Peon

    Messages:
    24
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #9
    It seems its working now. Make it aligned to central. The "Ads by Google" will distract users and will be clear its an add
     
    ashishmohta, May 12, 2007 IP
  10. daones

    daones Well-Known Member

    Messages:
    1,151
    Likes Received:
    39
    Best Answers:
    0
    Trophy Points:
    120
    #10
    What code do i use to make it align to the left more?
     
    daones, May 12, 2007 IP
  11. ashishmohta

    ashishmohta Peon

    Messages:
    24
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #11
    just use <left> whatever your code was there before </left>

    else use

    <center>whatever code was there </center>
     
    ashishmohta, May 12, 2007 IP
  12. daones

    daones Well-Known Member

    Messages:
    1,151
    Likes Received:
    39
    Best Answers:
    0
    Trophy Points:
    120
    #12
    heres the code i used tried center and left but still nothing changed

    <p>{literal}<left><script type="text/javascript"><!--
    google_ad_client = "
    google_ad_width = 468;
    google_ad_height = 15;
    google_ad_format = "468x15_0ads_al";
    //2007-05-12: fesusubmit
    google_ad_channel = "0696670757";
    //-->
    </script>
    <script type="text/javascript"
    src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
    </left></script>{/literal}<BR>
    </td>
     
    daones, May 12, 2007 IP
  13. ashishmohta

    ashishmohta Peon

    Messages:
    24
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #13
    First of all. I would say remove our pub id of adsense from there. You should not let it out.

    I use the same as yours above but i am not sure why its not showing for you. Guess thats a css problem. We can wait till somebody replies back
     
    ashishmohta, May 12, 2007 IP
  14. daones

    daones Well-Known Member

    Messages:
    1,151
    Likes Received:
    39
    Best Answers:
    0
    Trophy Points:
    120
    #14
    thanks, took out the code. Still kinda new to adsense
     
    daones, May 12, 2007 IP