How to apply Google Adsense to your gallery. How to apply Google Adsense to your gallery.
 

News:

CPG Release 1.6.26
Correct PHP8.2 issues with user and language managers.
Additional fixes for PHP 8.2
Correct PHP8 error with SMF 2.0 bridge.
Correct IPTC supplimental category parsing.
Download and info HERE

Main Menu

How to apply Google Adsense to your gallery.

Started by just_some_guy, September 26, 2007, 06:40:52 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

just_some_guy

Hello,

DEVS, you may wish to sticky/FAQ or make this a mod.

After struggling with this for a while and finally finding solutions i thought i would post them all here.

To see some in action see this demo

Contents:

- Adsense below the main menu
- Adsense above the main menu
- Adsense Below Image
- Adsense Above Image
- Adsense above the statistics (inside category section)
- Tips


Firstly, backup your files.




Adsense below main menu:

Open theme.html

find:

<td align="center" width="100%">{SYS_MENU}<br />
                                                                        {SUB_MENU} </td>
                                                                    </tr>
                                                                </tbody>
                                                            </table>
                                                            </div>


And after </div> paste your adsense code.

Adsense Above the main menu:

Open theme.html

find:
<table cellspacing="0" cellpadding="0" width="100%" align="center" border="0">
                                                    <tbody>


                                                        <tr>
                                                            <td class="row1" width="75%">
                                                            <div align="center">
                                                            <table cellspacing="0" cellpadding="0" width="100%" border="0">
                                                                <tbody>
                                                                    <tr>
                                                                        <td align="center" width="100%">{SYS_MENU}<font color="#ffffff">::</font> <a onmouseover="dropdownmenu(this, event, menu1, '150px')" onclick="return clickreturnvalue()" onmouseout="delayhidemenu()" href="default.htm">External Links</a> <br />
                                                                        {SUB_MENU} </td>
                                                                    </tr>
                                                                </tbody>
                                                            </table>


Paste your adsense code after the <tbody>



Adsense Below Image:

Open theme.php

Find:

<!-- BEGIN title -->


                                <tr>
                                        <td class="tableb"><center><b>
                                                {TITLE}
                                        </b></center></td>
                                </tr>
<!-- END title -->


And after <!-- BEGIN title --> paste your adsense code.

Adsense above image:

Open theme.php

Find:

// HTML template for intermediate image display
$template_display_media = <<<EOT
        <tr>
                <td align="center" class="display_media" nowrap="nowrap">
                        <table cellspacing="2" cellpadding="0" class="imageborder">
                             
<tr>
                                        <td align="center">

                                                {IMAGE}


And after:

<td align="center" class="display_media" nowrap="nowrap">
                        <table cellspacing="2" cellpadding="0" class="imageborder">


Paste your Adsense code.

Adsense above the statistics (inside category section):

Open theme.php

Find:


<!-- BEGIN catrow -->
        <tr>
                <td class="catrow" align="left"><img src="themes/Ti2000/images/folder.gif" border="0" width="25" height="25" alt="" align="left" /><table border="0"><tr><td>{CAT_THUMB}</td><td><span class="catlink"><b>{CAT_TITLE}</b></span>{CAT_DESC}</td></tr></table></td>
                <td class="catrow" align="center">{ALB_COUNT}</td>
                <td class="catrow" align="center">{PIC_COUNT}</td>
        </tr>
        <tr>
            <td class="tableb" colspan="3">{CAT_ALBUMS}</td>
                     
        </tr>

<!-- END catrow -->
               
<!-- BEGIN footer -->



       
        <tr>

                <td colspan="3" class="tableh1" align="center"><span class="statlink">{STATISTICS}</span></td>
        </tr>


<!-- END footer -->


After <!-- BEGIN footer -->

paste:


<tr>
<td>
ADSENSE CODE HERE
</td>
</tr>


Substitute "ADSENSE CODE HERE" for your adsense code.

Tips:

To position your ads to the left, right and center ou can do the following.


<div align="center">
ADSENSE CODE HERE
</div>


You can change "center" to left and right too.

I hope this helps you, thanks to all of the threads which helped me get some of the information required for this this thread.

Good Luck!

just_some_guy

Tambien, Hablo Español      PHP - Achieve Anything
"The Internet is becoming the town square for the global village of tomorrow. " - Bill Gates
Windows 7 Forums

Hein Traag

Hi Just_some_guy. I'm not a dev but thanks anyway for contributing to cpg.  ;D

just_some_guy

No problem, im happy to help and i hope this proves useful to other users.
Tambien, Hablo Español      PHP - Achieve Anything
"The Internet is becoming the town square for the global village of tomorrow. " - Bill Gates
Windows 7 Forums

Nibbler

1) No such file as theme.html
2) Many of your suggestions are not valid HTML.

just_some_guy

sorry, i meant template.html. Which code is not valid?

sorry + thanks,
Tambien, Hablo Español      PHP - Achieve Anything
"The Internet is becoming the town square for the global village of tomorrow. " - Bill Gates
Windows 7 Forums

thejflo

I'm curious. Why would one have to back up their files in order to do this? I thought it was just simple as pasting the code [where ever you want] in the template and thats it..

Tranz

Quote from: bychance on September 27, 2007, 12:18:55 AM
I'm curious. Why would one have to back up their files in order to do this? I thought it was just simple as pasting the code [where ever you want] in the template and thats it..
It's just good practice to back up files when editing files in case there are any mistakes.

sm3287

Hey, I'm trying to insert my adsense code under the stats like you have on your website "Sponsored Links". I cant for the life of me find any part of the code you listed.. Here is my template.html i also looked around theme.php and couldn't find nothing in there either. Any suggestions?

<!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>
<meta http-equiv="Content-Type" content="text/html; charset={CHARSET}" />
<meta http-equiv="Pragma" content="no-cache" />
<title>{TITLE}</title>
<link rel="stylesheet" type="text/css" href="themes/hardwired/style.css" />
{META}
<script type="text/javascript" src="scripts.js" ></script>
<!-- $Id: template.html 2808 2006-02-05 22:35:48Z gaugau $ -->
</head>
<body>
{CUSTOM_HEADER}
<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} <br><script type="text/javascript"><!--
google_ad_client = "pub-2518340886650978";
google_ad_width = 468;
google_ad_height = 15;
google_ad_format = "468x15_0ads_al_s";
google_ad_channel = "";
//-->
</script>
<script type="text/javascript"
  src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script></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>

Joachim Müller

@sm3287: the instructions in the initial posting of this thread are somewhat misleading and inacurate (that's why this thread hasn't been moved into the mods section as intended by the thread starter; there are better postings that explain how to add adsense or any other piece of static HTML/JavaScript to your Coppermine-driven pages). If a particular section (function or variable definition) doesn't exist in your custom theme, copy it (the missing section) from themes/sample/theme.php into a new line before?>of the file themes/yourtheme/theme.php, then edit as suggested in the initial posting of this thread.

@all: I suggest searching the board for the search term "adsense" - there are loads of postings that explain how to add adsense - many of them have better instructions and are more complete. If you still can't find what you're looking for, start a new thread for your issue, posting a link to your gallery. Additionally, zip the content of your custom theme folder and attach it to your new thread (using "additional options" when composing your message). If you want detailed answers, attach a screenshot of your gallery as well that highlights the section where you want your adsense code to show up. As these instructions (searching the board, starting a new thread with the required information) applies not only to you, but everyone who is looking for a similar thing, I will now close and lock this thread. Everyone who's looking to accomplish a similar thing should do as I suggested above.

@just_some_guy: please don't get me wrong: I appreciate your readiness to share your insight with others. However, your instructions can only be carried out by people with intermediate skills in coppermine - those who have those skills probably won't need instructions anyway. You're of course welcome to come up with a newbie-proof instructions in another thread.

Joachim