Advanced search  

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]

Pages: [1]   Go Down

Author Topic: Coppermine google adsense (coppermine display ads)  (Read 5250 times)

0 Members and 1 Guest are viewing this topic.

allvip

  • Global Moderator
  • Coppermine addict
  • *****
  • Country: 00
  • Offline Offline
  • Posts: 1290
Coppermine google adsense (coppermine display ads)
« on: May 31, 2014, 07:55:18 pm »

I don't see the point to use plugins or customheader or anycontent to display ads.I found it totally unnecessary.
I think custom header or anycontent or adsense plugin is better if you want it to show on all your themes but you don't have to many options for the location of the ads.

I have google adsense and tryed even another ads company.
Google code is like this:
<script>
.....
</script>
<ins
 ...
</ins>
<script>
.....
</script>

The other company code is like this:
<div
...
</div>
<script>
.....
</script>

Anyway I think is not important the code of your ad.It will work with my way of adding ads to coppermine.

1) I pasted the ad code in template.html after <body> and before </body> or before <div id="cpg_main_block_outer"> for the top ad to show after the main menu.I thinks is incorect to ad it after </body> or after </html> (if in your ads account says after </body> or after </html> then is ok).
You can add it anywhere in template.html.Depends where you want it to show.

2) TO ADD IT IN A MORE SPECIFIC PLACE you need to add it in theme.php.In template.html are only the main divs.
Here is some examples:

A) One small unit to the left of the image : open themes/your_theme_name/theme.php find <<<$template_display_media>>> (if is not in theme.php copy it from themes/sample/theme.php) and after :

Code: [Select]
                                        <td align="center" style="{SLIDESHOW_STYLE}">
                                                {IMAGE}
                                        </td>

add:

Code: [Select]
                                        <td width="30%">
                                                YOUR AD CODE HERE
                                        </td>

B) One unit before the image navmenu : open themes/your_theme_name/theme.php find function <<<theme_display_image>>> (if is not in theme.php copy it from themes/sample/theme.php) and before      echo $nav_menu; :

add:

Code: [Select]
    echo <<< EOT
    YOUR AD CODE HERE
EOT;

You need to use echo <<< EOT...because is a function with no html code like table,td,divs.If found this on coppermine docs but I don't find the bookmark to give you the link.

3) CUSTOM PAGES
You can also use tokens to make it show on one page and not show on other pages.

Example: you want it under the main menu only on the image page (you can not use <<<$template_display_media>>> because the main menu div is not there.$template_display_media has only the image tables and theme_display_image has only image nav menu,image,filmstrip,rating stars and comments).

1.add this code to function pageheader before $template_vars = CPGPluginAPI::filter('theme_pageheader_params', $template_vars);(if the function is not in your themes/your_theme_name/theme.php copy it from themes/sample/theme.php):

Code: [Select]
    global $CPG_PHP_SELF;
    $superCage = Inspekt::makeSuperCage();
    if ($CPG_PHP_SELF == 'displayimage.php') {
        $template_vars['{ADSIMAGE}'] = <<< EOT
        YOUR AD CODE HERE
EOT;
    } else {
        $template_vars['{ADSIMAGE}'] = '';
    }


2. add {ADSIMAGE} to template.html where you want the ad to show like before <div id="cpg_main_block_outer"> to show under main menu.

3.You can name the token the way you want.I name it ADSIMAGE (you can replace the word ADSIMAGE with your custom word).Just make sure is not a word already used by coppermine in tokens like IMAGE.

IF you want to show only on home page replace:

if ($CPG_PHP_SELF == 'displayimage.php') {  from the code with:

Code: [Select]
if ($CPG_PHP_SELF == 'index.php' && !count($superCage->get->_source)) {
IF you want to show on all index pages: index?cat=102 etc replace displayimage.php from the code with index.php.

IF you want to show only on thumbnails.php replace displayimage.php from the code with thumbnails.php.

You can make how many tokens you want.Example:

Code: [Select]
    global $CPG_PHP_SELF;
    $superCage = Inspekt::makeSuperCage();
    if ($CPG_PHP_SELF == 'displayimage.php') {
        $template_vars['{ADSIMAGE}'] = <<< EOT
        YOUR AD CODE HERE
EOT;
    } else {
        $template_vars['{ADSIMAGE}'] = '';
    }
    global $CPG_PHP_SELF;
    $superCage = Inspekt::makeSuperCage();
    if ($CPG_PHP_SELF == 'index.php') {
        $template_vars['{ADSINDEX}'] = <<< EOT
        YOUR AD CODE HERE
EOT;
    } else {
        $template_vars['{ADSINDEX}'] = '';
    }

ad to template.html tokens {ADSIMAGE} and {ADSINDEX} before <div id="cpg_main_block_outer"> or one before <div id="cpg_main_block_outer"> and one before <div id="cpg_footer_block_outer">.
« Last Edit: May 31, 2014, 08:25:49 pm by allvip »
Logged

allvip

  • Global Moderator
  • Coppermine addict
  • *****
  • Country: 00
  • Offline Offline
  • Posts: 1290
Re: Coppermine google adsense (coppermine display ads)
« Reply #1 on: May 31, 2014, 07:59:53 pm »

Is possible to add it where you want (using the right function - all the functions are in themes/sample/theme.php),how many you want and on the pages you want using tokens.

IMPORTANT Delete all other themes from themes folder including sample theme as users can type your_domain_name/your_gallery_folder/index.php?theme=other_theme_name or your_domain_name/index.php?theme=other_theme_name and see your gallery with a theme with no ads.
Just keep them in your computer.

IMPORTANT The main menu has the drop down links on hover (for the curve theme anyway).They shoud not be over the ads.Is against adsense policy.Nothing shoud be to close to the ads or over the ads to encourage accidental clicks) or between thumbnails or links for users to mistake the ads with your content.They will close account with no way back.Read all the their rules.
Don't put to many units.I thinks is max 3 units per page and only one can be a square.
« Last Edit: May 31, 2014, 08:50:16 pm by allvip »
Logged

allvip

  • Global Moderator
  • Coppermine addict
  • *****
  • Country: 00
  • Offline Offline
  • Posts: 1290
Re: Coppermine google adsense (coppermine display ads)
« Reply #2 on: May 31, 2014, 08:35:19 pm »

Adding facebook comments to coppermine (even facebook like works with Andre's code from the thread):

thread : http://forum.coppermine-gallery.net/index.php?topic=76925.0

Logged
Pages: [1]   Go Up
 

Page created in 0.02 seconds with 21 queries.