Adsense in Coppermine Adsense in Coppermine
 

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

Adsense in Coppermine

Started by jeroenisblij, December 03, 2005, 03:08:04 PM

Previous topic - Next topic

0 Members and 2 Guests are viewing this topic.

jeroenisblij

Hello. i love coppermine, i use it to share pictures from my friends, family, clubs, etc. I would like to add some google ads to win back the hosting costs. Im a worthless coder myself... is there a plugin availeble that adds google ads in a nice way to every page?

Paver

You could try "Master_Template" over at cpg-contrib.org.

But if you are not changing templates often, you can merely modify the theme of your choice to display them on every page.  Depending upon where you want to put them, you can use the relevant code from the "sample" theme which includes all the template features in one place.  If you find another theme with an image or text in the place you want your Google Ads, go to that theme, find the image or text and you'll know where to put it in your custom theme.  Remember that it's best to create a new theme when customizing a theme (by copying the folder of the one that's closest).

jeroenisblij

i've been trying too add a row to a table it to the theme.php but i cant get it to display nicely. If i add it somewhere in the first half of the theme.php it displays above the album but if i add it in the starttable function it gets displayted multiple times: http://www.snekerstappers.nl/coppermine/blabla12.JPG // http://pastebin.com/447610
I would like to display it only between the categorie navigation and picture navigation where should i insert code so it displays only there?

donnoman

why don't you just put it in a div in anycontent.php and add anycontent to your content of the main page?

jeroenisblij

Quote from: donnoman on December 03, 2005, 10:14:08 PM
why don't you just put it in a div in anycontent.php and add anycontent to your content of the main page?
this sounds very logical but ive no idea how to put a div in anycontent.php or how to add anycontent to my main page...
any chance you could paste an example code on pastebin.com?

Paver

The file anycontent.php is in your main Coppermine directory.  To add it to your main page, go to Config - Album List View - Content of Main Page and put 'anycontent' wherever you like.  I have "breadcrumb/catlist/anycontent/alblist/random,1/lastup,1".  Then modify anycontent.php to your heart's desire. 

donnoman's suggestion to use a <div> was so you can style it and place it however and wherever you like.  For example in anycontent.php (after the top comment stuff):
if (!defined('IN_COPPERMINE')) die('Not in Coppermine...');
?>
<style>
div.GoogleAds {
position:absolute;
left:15px;
top:15px;
}
</style>
<div class="GoogleAds">GoogleAds</div>


This will position "GoogleAds" on top of the page in the top left corner.  Of course you'll have to make some room or organize things in a reasonable way.  Here's a reference for <div>: http://www.w3.org/TR/REC-html40/struct/global.html#h-7.5.4.  To find more information about styling <div>, search for "div dhtml".

donnoman

If you want it on every page, you could use the custom_header or custom_footer as well.

Doing it is almost the same as anycontent.php except that you use a different filename, and you put the path relative to coppermine to that file, in the matching config option.

jeroenisblij

Quote from: donnoman on December 04, 2005, 07:42:53 PM
If you want it on every page, you could use the custom_header or custom_footer as well.
Doing it is almost the same as anycontent.php except that you use a different filename, and you put the path relative to coppermine to that file, in the matching config option.
Ive tried putting it in the anycontent.php. This looks very nice, i can easily place it anywhere on the frontpage, but it is only shown on the frontpage. I would like it on every page. Is there a way to add anycontent to the displayimage window?
Ive also tried putting the code in the 'custom header' field but this is very ugly. It gets shown on every page, but on the total top of the page, even above the title and logo which makes the site look very messy. dunno if this is how you meant it, didnt quite understand what you mean with 'put the path relative to coppermine to that file, in the matching config option.'
I would like it to display on every page, preferebly either between the categorie navigation and picture navigation bar, or next to the image in the displayimage window. Any other options? tnx again :D

Joachim Müller

I don't get it - why are you trying to make things so complicated? Just add your adsense code to themes/yourtheme/template.html (anywhere you like) and you're done.

Wabz

I understand what the guy likes to do.  As I'm after a rather similar thing.

I'd like to replace the Text next to the Coppermine logo with Googles adsense.  On everypage.

Which code would I have to change in the default template?  I'm not to good with php as I'm just basically a network operator. 

Nibbler

Just paste the adsense code into your template.html, no php required.

Wabz

Cool :)

What do I replace the

<td width="100%" align="center">
              <h1>{GAL_NAME}</h1>
              <h3>{GAL_DESCRIPTION}</h3><br />
              {SYS_MENU} <br /> {SUB_MENU}
            </td>


With my adsense code ?

Paver

Paste, not replace.  Add it in.  Then, after you see Google Adsense on your page, if you want to delete anything (like the Coppermine logo), find it and delete it.

You do have to understand HTML to edit template.html.  If you don't, please search the web for a simple HTML tutorial.