Adding Google Adsense to Hardwired Theme Adding Google Adsense to Hardwired Theme
 

News:

cpg1.5.48 Security release - upgrade mandatory!
The Coppermine development team is releasing a security update for Coppermine in order to counter a recently discovered vulnerability. It is important that all users who run version cpg1.5.46 or older update to this latest version as soon as possible.
[more]

Main Menu

Adding Google Adsense to Hardwired Theme

Started by version, January 05, 2006, 02:31:42 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

version

Hey. I searched all through the forums and tried multiple different things to get Google Adsense to display with this theme but for some reason i have no luck. I've added code to theme.php, template.html, and even tried in themes.inc.php with no luck. At the moment i have removed the code from the site as it wasnt doing anything. This is the website address i want to add it too. http://version.three-point-o.com

My google adsense code that i want to use is this:

<script type="text/javascript"><!--
google_ad_client = "pub-3719969883533579";
google_ad_width = 468;
google_ad_height = 60;
google_ad_format = "468x60_as";
google_ad_type = "text_image";
google_ad_channel ="";
google_color_border = "191933";
google_color_bg = "333366";
google_color_link = "99CC33";
google_color_url = "FFCC00";
google_color_text = "FFFFFF";
//--></script>
<script type="text/javascript"
  src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script>

If anyone can help me out or inform me where im meant to be putting this code would be real great.

Thanks in advance for the help

version

Joachim Müller


version

thanks for the reply GauGau but did you read the post? I have added it to themes/yourtheme/template.html plus other files with no luck of it displaying at all. Does it matter where in the template.html that i put it because no matter where i try it doesnt seem to make a difference.

Quote<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" dir="{LANG_DIR}">
<head>
<title>{TITLE}</title>
<meta http-equiv="Content-Type" content="text/html; charset={CHARSET}" />
<meta http-equiv="Pragma" content="no-cache" />
<link rel="stylesheet" type="text/css" href="themes/hardwired/style.css" />
{META}
<script type="text/javascript" src="scripts.js" ></script>
<!-- $Id: template.html,v 1.18 2005/08/12 03:19:38 donnoman Exp $ -->
</head>
{CUSTOM_HEADER}
<body>
<table width="100%"  border="0" cellspacing="0" cellpadding="0">
  <tr valign="top">
    <td width="53" rowspan="3" id="far-left"><img src="themes/hardwired/images/far-left.gif" width="54" height="14" alt="" /></td>
    <td width="18" class="middle-left"><img src="themes/hardwired/images/middle-left.gif" width="18" height="14" alt="" /></td>
    <td height="62" class="right-banner">
        <div class="left-banner">
        <div class="gal_name">{GAL_NAME}</div>
        <div class="gal_description">{GAL_DESCRIPTION}</div>
        </div>
    </td>
    <td width="19" class="middle-right"><img src="themes/hardwired/images/middle-right.gif" width="19" height="14" alt="" /></td>
    <td width="53" rowspan="3" class="far-right"><img src="themes/hardwired/images/far-right.gif" width="53" height="14" alt="" /></td>
  </tr>
  <tr>
    <td width="18" class="middle-left">&nbsp;</td>
    <td class="gallery"><div align="right" class="topmenu"> {SYS_MENU} </div>
      <br />
      <div align="left" class="topmenu">{SUB_MENU}</div> <br />
      <div align="center"> {THEME_SELECT_LIST} {LANGUAGE_SELECT_LIST} </div>
      <br />
      {ADMIN_MENU} {GALLERY}</td>
    <td width="19" class="middle-right">&nbsp;</td>
  </tr>
  <tr valign="baseline">
    <td width="18" class="middle-left"><img src="themes/hardwired/images/bottom-left.gif" width="18" height="31" alt="" /></td>
    <td class="bottom-middle">&nbsp;</td>
    <td width="19" class="middle-right"><img src="themes/hardwired/images/bottom-right.gif" width="19" height="31" alt="" /></td>
  </tr>
</table>
<br />

<div align="center"> {LANGUAGE_SELECT_FLAGS} <br />
  <br />
</div>
{CUSTOM_FOOTER}
{VANITY}
</body>
</html>

This is the template file from the hardwired theme. Where do you suggest putting the adsense code to actually get it to show on my site?

Thanks again

v3

Antifmradio

the problem is that GOOGLE ADSENCE will only show on pages with relevant information
which google scans and placed informative advertisment links onto your page

using a page like a photo album or any gallery is well beyond the allowed formats of use for Google Adsence.

Its not that youre doing it wrong, its just your doing it in the wrong place.
Sorry

Imagine it this way, say you wanted to display Adsence on a page where theres no text and only one picture.
Whats google going to scan your page for?

Casper

Sorry anti, but google adsence works fine in coppermine.  I have had it working on several sites.

As gagau said, it has to be placed in the theme/template.html.

@ version, will it display on your site when using other themes?

And do you have any file such as .htaccess that may prevent it from working?
It has been a long time now since I did my little bit here, and have done no coding or any other such stuff since. I'm back to being a noob here

version

My .htaccess file is empty. I tried putting the adsense code into the classic theme of coppermine but still cant get it to show anywhere on the site. It should at least show random ads i would have thought.

Quote<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html dir="{LANG_DIR}">
<head>
<title>{TITLE}</title>
<meta http-equiv="Content-Type" content="text/html; charset={CHARSET}" />
<meta http-equiv="Pragma" content="no-cache" />
{META}
<link rel="stylesheet" href="themes/classic/style.css" type="text/css" />
<script type="text/javascript" src="scripts.js"></script>
<!-- $Id: template.html,v 1.18 2005/10/25 01:16:24 gaugau Exp $ -->
</head>
<body>
  {CUSTOM_HEADER}
  <table width="100%" border="0" cellpadding="20" cellspacing="20">
    <tr>
      <td valign="top" style="border: 1px solid #666666;background-color:#FFFFFF;">
        <table width="100%" border="0" cellspacing="0" cellpadding="0">
          <tr>
            <td>
              <a href="index.php"><img src="themes/classic/images/site_logo.png" border="0" alt="" /></a><br />
            </td>
            <td width="100%" align="center">
              <h1>{GAL_NAME}</h1>
              <h3>{GAL_DESCRIPTION}</h3><br />
              {SYS_MENU} <br /> {SUB_MENU}
            </td>
          </tr>
        </table>
        <table width="100%" border="0" cellspacing="0" cellpadding="0">
          <tr>
            <td align="center" valign="top">
              {LANGUAGE_SELECT_FLAGS}
            </td>
          </tr>
          <tr>
            <td align="center" valign="top">
              {THEME_SELECT_LIST}
              {LANGUAGE_SELECT_LIST}
            </td>
          </tr>
        </table>
        <img src="images/spacer.gif" width="1" height="15" alt="" />
        <br />
        <table width="100%" border="0" align="center" cellpadding="0" cellspacing="0">
          <tr>
            <td align="left" valign="top">
              {ADMIN_MENU}
              {GALLERY}
            </td>
          </tr>
        </table>
      </td>
    </tr>
  </table>
  {CUSTOM_FOOTER}{VANITY}
</body>
</html>

Heres my calssic theme template.html

Casper

So where's the adsence code?  It's not in the template you posted above.

If you are using a banner style ad, try putting it in like this.  As you can see I've just added a row avove the gallery title and logo row, and placed the code there;

<body>
  {CUSTOM_HEADER}
  <table width="100%" border="0" cellpadding="20" cellspacing="20">
    <tr>
      <td valign="top" style="border: 1px solid #666666;background-color:#FFFFFF;">
        <table width="100%" border="0" cellspacing="0" cellpadding="0">
<!--Added row and Google code -->
  <tr>
            <td colspan="2">
Your adsence code here
</td>
  </tr>
  <!--End Google code -->
          <tr>
            <td>
              <a href="index.php"><img src="themes/classic/images/site_logo.png" border="0" alt="" /></a><br />
It has been a long time now since I did my little bit here, and have done no coding or any other such stuff since. I'm back to being a noob here

Joachim Müller


version


coolazzrob

I followed the instructions and it worked great.  I just have one small problem that I cannot figure out.  I know the answer is a simple one but it is a simple one that is over my head.  Here is a link to my gallery  http://www.ebonydateconnection.net/cpg/index.php  What I need to know is how do I center my adds at the top like they are at the bottom of the page?

Thanks

Joachim Müller

Quote from: coolazzrob on August 25, 2006, 05:35:58 AM
like they are at the bottom of the page?
They are not. Both blocks are left-aligned for me. The code you pasted in is crap, you started with <tr><td> outdside a table - this will lead to unexpected results. This is plain HTML, no particular Coppermine skills needed. Just wrap your GoogleAd code into valid HTML (a <div> container with the alignement attribute you like would be fine). Maybe you pasted BS in, because you're trying to hijack a thread made for another theme that is tagged as solved.

Sweetleaf

Just add the google code after   {CUSTOM_FOOTER}{VANITY}
on all themes and google absense works awesome  shows at bottom  not top 

SR-Travis

Firstly, thanks for the help above in getting the Adsense to work.
Secondly, can I get some assistance in helping to centre my Google ads, I have listed my template.html code and this tends to stay aligned left? I am not conversant with html enough to understand why it is not working...

The site is "justmining.com"

------------------------------------------------------------------

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html dir="{LANG_DIR}">
<head>
<meta http-equiv="Content-Type" content="text/html; charset={CHARSET}" />
<meta http-equiv="Pragma" content="no-cache" />
<title>{TITLE}</title>
{META}
<link rel="stylesheet" href="themes/igames/style.css" type="text/css" />
<script type="text/javascript" src="scripts.js"></script>
<script language="JavaScript" type="text/JavaScript">
<!--
function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers.document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_showHideLayers() { //v6.0
  var i,p,v,obj,args=MM_showHideLayers.arguments;
  for (i=0; i<(args.length-2); i+=3) if ((obj=MM_findObj(args))!=null) { v=args[i+2];
    if (obj.style) { obj=obj.style; v=(v=='show')?'visible':(v=='hide')?'hidden':v; }
    obj.visibility=v; }
}
//-->
</script>
<!-- $Id: template.html 2688 2005-12-04 03:22:35Z donnoman $ -->
</head>
<body>
<div id="CUSTOM_HEADER">
  {CUSTOM_HEADER}
  </div>
 

 
<div class="top_panel">
  <div class="top_panel_left">
    <div class="top_panel_right">
      <div id="SELECT_LISTS">
        {THEME_SELECT_LIST}
        {LANGUAGE_SELECT_LIST}
      </div>
      <h1>{GAL_NAME}</h1>
      <h3>{GAL_DESCRIPTION}</h3>
    </div>
  </div>
</div>

<div class="top_panel_btm">

</div>


<div id="MENUS">
  <div id="SUB_MENU">
    {SUB_MENU}
  </div>

  <div id="SYS_MENU">
    {SYS_MENU}
  </div>
 
  <centre><script type="text/javascript"><!--
google_ad_client = ".....";
google_ad_width = 728;
google_ad_height = 90;
google_ad_format = "728x90_as";
google_ad_type = "text";
google_ad_channel ="1343314737";
google_color_border = "4C4C4C";
google_color_bg = "4C4C4C";
google_color_link = "FFFFCC";
google_color_text = "FFFFCC";
google_color_url = "999999";
//--></script>
<script type="text/javascript"
  src=".....">
</script></centre>


<div id="GALLERY">
      {ADMIN_MENU}
      {GALLERY}
      </div>
<div id="SELECT_FLAGS">
{LANGUAGE_SELECT_FLAGS}
<br>
&nbsp;</div>
<div id="CUSTOM_FOOTER">
  {CUSTOM_FOOTER}
  </div>
  <div id="VANITY">
  {VANITY}
  </div>

</body>
</html>

Nibbler

You need to spell it center, the american way.

SR-Travis

Hi Nibbler,

That made it spot on....

Many Thanks
Travis
(I'm Australian.. So dont hold it against me  :P )