HOWTO insert adsense into Gallery 2
As I was trying to insert some ads into my gallery 2 photo album I went for some help to one useful search engine.
In conclussion I concluded with this results, which can be viewed going into current el demonion negro album
To add AdSense to my Gallery2 sidebar I followed next steps:
- Copy themes/CHOOSEDTHEME/templates/sidebar.tpl to theme/CHOOSEDTHEME/templates/sidebar.tpl.original on your server. It’s useful to backup.
- Create the file adsense.tpl which will contain all your AdSense code - e.g., you could see my own file later on. Put all your AdSense code into that file, and upload the file to your theme/CHOOSEDTHEME/templates/ folder on the server.
- now edit the sidebar.tpl file. The differences between my original and current file look like this:
user@aristoteles:/usr/share/gallery2/themes/classic/templates#
user@aristoteles:/usr/share/gallery2/themes/classic/templates$ diff sidebar.tpl.original sidebar.tpl
8,13d7
< < div id="gAds" class="gbBlock" >
< {if $user.isGuest == 1}
< {* Adsense code *}
< {g->theme include=”adsense.tpl”}
< {/if}
< < /div >
UPTADED 2007-04-09:
user@aristoteles:/usr/share/gallery2/themes/classic/templates# mkdir local
It would be better to put the modified sidebar.tpl (and any modified files under templates) to a new directory called local. Thus you’ll preserve this changes when upgrading gallery2 versions. For example:
user@aristoteles:/usr/share/gallery2/themes/classic/templates# cp sidebar.tpl local/
user@aristoteles:/usr/share/gallery2/themes/classic/templates# mv sidebar.tpl.original sidebar.tpl
user@aristoteles:/usr/share/gallery2/themes/classic/templates# cat adsense.tpl
< script type="text/javascript" > < !--
google_ad_client = "pub-XXXnumbesrXXX";
google_ad_width = 120;
google_ad_height = 240;
google_ad_format = "120x240_as";
google_ad_type = "text_image";
//2007-01-31: AlbumIzquierda (description)
google_ad_channel = "XXXnumbesrXXX";
google_color_border = "336699";
google_color_bg = "FFFFFF";
google_color_link = "0000FF";
google_color_text = "000000";
google_color_url = "008000";
//-- > < /script >
< script type="text/javascript" src="http://pagead2.googlesyndication.com/pagead/show_ads.js" > < /script >
It’s not as easy like a module selection, but right now is a solution. This has been done for sidebar, but maybe could have been done anywhere else.
If anyone optimizes this or has done something different, commets will be welcomed.
Últimos comentarios