欢迎大家赞助一杯啤酒🍺 我们准备了下酒菜:Formal mathematics/Isabelle/ML, Formal verification/Coq/ACL2, C++/F#/Lisp
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
--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
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.
{/if} {* end of full screen check *}
Remember to use
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"}
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