Gallery2:How to add Google Adsense

来自开放百科 - 灰狐
跳转到: 导航, 搜索

This article describes how you can include Google AdSense in your Gallery-powered website to generate revenue by displaying Google Ads.

This How to is made for the default Gallery theme (matrix).

First create a new tpl file under /gallery2/themes/matrix/templates/local/

I called this file adsense.tpl

Edit this file and insert the following code:

     {php}
     $adcode = <<<END
     HERE COMES YOUR GOOGLE BANNER CODE (its better to use 468x60 size)
     END;
     echo $adcode;
     {/php}

now you have to copy /gallery2/themes/matrix/templates/theme.tpl to /gallery2/themes/matrix/templates/local/ and edit /gallery2/themes/matrix/templates/local/theme.tpl

After the logo line add this code:

      {g->theme include="adsense.tpl"}

thats it!

you can see a live demo on my site

Kedem photos or mapmyphoto


--Omrik 08:44, 17 April 2006 (PDT)


There is another way to add Google AdSense in Gallery2. You have to copy /gallery2/themes/matrix/templates/theme.tpl to /gallery2/themes/matrix/templates/local/ and edit /gallery2/themes/matrix/templates/local/theme.tpl.Find:

<img src="{g->url href="images/galleryLogo_sm.gif"}" width="107" height="48" alt=""/>

After that add the Adsense code, if you want to center the banner you have to use

<--ADSENSE CODE-->

You can see a libe demo on my site.

But there is a problem is you use the Xp's Tool to publish photos from your Pc you have to deactivate the code, you can rename /gallery2/themes/matrix/templates/local/ folder and after upload the photos rename again.


You can add a Adsense Banner in the footer. Find the following code and bellow that add your adsense code.

{g->logoButton type="validation"} {g->logoButton type="gallery2"} {g->logoButton type="gallery2-version"} {g->logoButton type="donate"}

     {/if}  {* end of full screen check *}

Remember to use

<--ADSENSE CODE-->


Installing 120X600 Adsense Skyscraper in Side Bar

1.Using the default 'Matrix' theme open file: /matrix/templates/sidebar.tpl

2.Below {g->block type="core.NavigationLinks" class="gbBlock"}

add your Adsense code for the 120x600 banner.

3.This will display the 120x600 banner in your side bar and blend it with the colors of the Matrix theme.
View Example Here The 360 Index Gallery.


来源: http://codex.gallery2.org/index.php/Gallery2:How_to_add_adsense

分享您的观点
个人工具
名字空间

变换
操作
导航
工具箱