Help to Ad Adsense Help to Ad Adsense
 

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

Help to Ad Adsense

Started by AngelC, May 20, 2006, 08:18:47 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

AngelC

I search in this forum but i dont find that i need. I will like put google adsense in my cpg . I will like to put google adsense codes in this sites:

1:
[Edit GauGau] Replaced hotlinked image with attachment adsense14gs.jpg [/Edit]

2:
[Edit GauGau] Replaced hotlinked image with attachment adsense20cg.jpg [/Edit]

thx a lot


Joachim Müller


AngelC

i know to put the code in the template but not in the sitesthat i choose....

Joachim Müller

you can't insert the AdSense code into template.html, you'll have to edit themes/yourtheme/theme.php. Find// HTML template for the album list. If it doesn't exist in your custom theme, copy the corresponding section from themes/sample/theme.php. In this case, copy// HTML template for the album list
$template_album_list_cat = <<<EOT

<!-- BEGIN c_stat_row -->
        <tr>
                <td colspan="{COLUMNS}" class="tableh1" align="center"><span class="statlink"><b>{STATISTICS}</b></span></td>
        </tr>
<!-- END c_stat_row -->
<!-- BEGIN c_header -->
        <tr>
<!-- END c_header -->
<!-- BEGIN c_album_cell -->
        <td width="{COL_WIDTH}%" valign="top">
        <table width="100%" cellspacing="0" cellpadding="0">
        <tr>
                <td colspan="3" height="1" valign="top" class="tableh2">
                        <span class="alblink"><a href="{ALB_LINK_TGT}"><b>{ALBUM_TITLE}</b></a></span>
                </td>
        </tr>
        <tr>
                <td colspan="3">
                        <img src="images/spacer.gif" width="1" height="1" border="0" alt="" /><br />
                </td>
        </tr>
        <tr>
                <td align="center" valign="middle" class="thumbnails">
                        <img src="images/spacer.gif" width="{THUMB_CELL_WIDTH}" height="1" class="image" style="margin-top: 0px; margin-bottom: 0px; border: none;" alt="" /><br />
                        <a href="{ALB_LINK_TGT}" class="albums">{ALB_LINK_PIC}<br /></a>
                </td>
                <td>
                        <img src="images/spacer.gif" width="1" height="1" border="0" alt="" />
                </td>
                <td width="100%" valign="top" class="tableb_compact">
                        {ADMIN_MENU}
                        <p>{ALB_DESC}</p>
                        <p class="album_stat">{ALB_INFOS}</p>
                </td>
        </tr>
        </table>
        </td>
<!-- END c_album_cell -->
<!-- BEGIN c_empty_cell -->
        <td width="{COL_WIDTH}%" valign="top">
        <table width="100%" cellspacing="0" cellpadding="0" >
        <tr>
                <td height="1" valign="top" class="tableh2">
                        <b>&nbsp;</b>
                </td>
        </tr>
        <tr>
                <td>
                        <img src="images/spacer.gif" width="1" height="1" border="0" alt="" /><br />
                </td>
        </tr>
        <tr>
                <td width="100%" valign="top" class="tableb_compact" >
                      <div class="thumbnails" style="background-color:transparent"><img src="images/spacer.gif" width="1" height="{SPACER}" border="0" class="image" style="border:0;margin-top:1px;margin-bottom:0" alt="" /></div>
                </td>
        </tr>
        </table>
        </td>
<!-- END c_empty_cell -->
<!-- BEGIN c_row_separator -->
        </tr>
        <tr>
<!-- END c_row_separator -->
<!-- BEGIN c_footer -->
        </tr>
<!-- END c_footer -->
<!-- BEGIN c_tabs -->
        <tr>
                <td colspan="{COLUMNS}" style="padding: 0px;">
                        <table width="100%" cellspacing="0" cellpadding="0">
                                <tr>
                                       {TABS}
                                </tr>
                        </table>
                </td>
        </tr>
<!-- END c_tabs -->
<!-- BEGIN c_spacer -->
        <img src="images/spacer.gif" width="1" height="7" border="" alt="" /><br />
<!-- END c_spacer -->

EOT;
and paste it into themes/yourtheme/theme.php into a new line before ?>

Then edit it accordingly, i.e. find// HTML template for the album list
$template_album_list_cat = <<<EOT

<!-- BEGIN c_stat_row -->
        <tr>
                <td colspan="{COLUMNS}" class="tableh1" align="center"><span class="statlink"><b>{STATISTICS}</b></span></td>
        </tr>
<!-- END c_stat_row -->
and replace with// HTML template for the album list
$template_album_list_cat = <<<EOT

        <tr>
                <td colspan="{COLUMNS}" class="tableb">
                <!-- YOUR ADSENSE CODE GOES HERE -->
                </td>
        </tr>
<!-- BEGIN c_stat_row -->
        <tr>
                <td colspan="{COLUMNS}" class="tableh1" align="center"><span class="statlink"><b>{STATISTICS}</b></span></td>
        </tr>
<!-- END c_stat_row -->






A similar thing needs to be done for displaying adsense (or any other custom HTML) on the screen that shows an individual image: find// HTML template for intermediate image display, paste the corresponding section from the sample theme into your custom theme if it doesn't exist, then add your custom code to it. In your case, paste// HTML template for intermediate image display
$template_display_media = <<<EOT
        <tr>
                <td align="center" class="display_media" nowrap="nowrap">
                        <table cellspacing="2px" cellpadding="0px" class="imageborder">
                                <tr>
                                        <td align="center">
                                                {IMAGE}

                                        </td>
                                </tr>
                        </table>
                </td></tr>
                <tr><td>
                                                <table width="100%" cellspacing="2px" cellpadding="0px" class="tableb">
                                <tr>
                                        <td align="center">

                                                {ADMIN_MENU}
                                        </td>
                                </tr>
                                <tr>
                                        <td align="center">
                                                <!-- YOUR CUSTOM CODE HERE -->
                                        </td>
                                </tr>
                        </table>





<!-- BEGIN img_desc -->
                        <table cellpadding="0px" cellspacing="0px" class="tableb" width="100%">
<!-- BEGIN title -->
                                <tr>
                                        <td class="tableb"><center><b>
                                                {TITLE}
                                        </b></center></td>
                                </tr>
<!-- END title -->
<!-- BEGIN caption -->
                                <tr>
                                        <td class="tableb"><center>
                                                {CAPTION}
                                        </center></td>
                                </tr>
<!-- END caption -->
                        </table>
<!-- END img_desc -->
                </td>
        </tr>

EOT;
into your theme.




Some of the threads that can be found when searching for the term "Adsense" would have told you so as well, not all say to edit template.html. It's mandatory that you understand what you're doing, that's why I haven't pasted code into this posting that is ready for copy'n paste.

AngelC


snadowitz

Quote from: AngelC on May 22, 2006, 07:58:27 PM
Thx a lot :D i will try now

Hi AngelC - seems you got it to work. I cannot :( - any chance you can send me a copy of your theme.php?

Joachim Müller

What's wrong with my instructions? We don't believe in just giving users code they don't understand and just apply. We prefer to educate them to make them understand what they're doing and enable them to apply future changes on their own. This is what you should do: show us what you currently have by posting a link to your coppermine-driven gallery and zip up your custom theme and attach it to your posting using the "additional options" link at the bottom of the page when composing your message.

snadowitz

HI - I did copy your instructions to the letter - I don't actually want to insert adsense but some other custom code from commission junction. I modified the theme file as you said and it had no discernable effect on the page whatsoever.

Joachim Müller

What's the use of your reply? I told you what to do if you want help. Anyway, as this thread deals with adding adsense code, you shouldn't have tried to hijack it in the first place. Start a new thread, providing the information needed as per my suggestion above.

bobby131313


GauGau, I found your help excellent.

Studying your code changes made the big light bulb over my head go off. It's actually pretty simple if your somewhat familiar with coding, I just needed a kick towards where to find it.

You basically just look at theme.php in the sample folder which has all the section templates, import the section you want to edit from there if you don't have it already in you current theme.php, and edit away. Basic html, cool stuff!

Thank you, GauGau!

Does the order that the sections are in theme.php make a difference? I've just been adding them at the end so far and nothing has exploded yet. Maybe I've just been lucky though?


Tranz

The order shouldn't matter. Adding it to the end is a good way to make sure the code doesn't get inserted in the wrong place.