Not logged in. · Lost password · Register
Forum: General Help and Support Templates and Layout RSS
Can I add Adsense into dokuwiki template ?
I want to add Adsense into my wiki
Avatar
tester00125 #1
Member since Jan 2015 · 9 posts
Group memberships: Members
Show profile · Link to this post
Subject: Can I add Adsense into dokuwiki template ?
Hi everyone, I want to add Adsense into my wiki. I install googleads plugin but I don't know Where should i add the ads google code in my template.  thank a lot for your waste time to read or reply me.
Avatar
turnermm (Moderator) #2
Member since Oct 2009 · 4399 posts · Location: Canada
Group memberships: Global Moderators, Members, Super Mods
Show profile · Link to this post
Well, if the plugin works, there's no reason you can't do it on your site. But given the layout of the Dokuwiki template, I can't see where you can put ads on the main page that will be in any way attractive. If you are using a sidebar, you could put them in a sidebar footer by making a small change to main.php.  If you have a sidebar, in the template directory (tpl), you can create a file named sidebarfooter.php and place the google code in that file.  Then in main.php, where you find
<?php tpl_includeFile('sidebarfooter.html') ?>
change sidebarfooter.html to sidebarfooter.php.
Myron Turner
github: https://github.com/turnermm
plugins, templates: http://www.mturner.org/devel
Avatar
tester00125 #3
Member since Jan 2015 · 9 posts
Group memberships: Members
Show profile · Link to this post
Hello turnermm,

I upload sidebarfooter.php to /lib/tpl/dokuwiki and change main.php like you suggest. but I not see sidebar on my wiki (I use default template)

my main.php
[Image: http://i725.photobucket.com/albums/ww251/tester00125/8888_zpsurovro11.png]

my wikipage
[Image: http://i725.photobucket.com/albums/ww251/tester00125/9999_zpszx25cmxq.png]

If you do not mind. please tell me what I should to do and let's me know if you want any information. thank you
Avatar
turnermm (Moderator) #4
Member since Oct 2009 · 4399 posts · Location: Canada
Group memberships: Global Moderators, Members, Super Mods
Show profile · Link to this post
You need to create a sidebar page in the topmost Dokuwiki directory by opening and saving:  ?id=sidebar. You will have to save some text in it.
Myron Turner
github: https://github.com/turnermm
plugins, templates: http://www.mturner.org/devel
Avatar
tester00125 #5
Member since Jan 2015 · 9 posts
Group memberships: Members
Show profile · Link to this post
Quote by turnermm:
You need to create a sidebar page in the topmost Dokuwiki directory by opening and saving:  ?id=sidebar. You will have to save some text in it.

Thank you turnermm.
Is this "topmost Dokuwiki directory" ?
[Image: http://i725.photobucket.com/albums/ww251/tester00125/000_zpsvniyqnr8.png]

and if it is, now I create filename : sidebar.php in that directory. is it correct ?
Avatar
Torpedo #6
Member since Aug 2014 · 81 posts
Group memberships: Members
Show profile · Link to this post
Hi,
once I did this:
1) Configuration Setting > Allow embedded HTML
2) In my page *.txt I wrote:
<HTML>
<script type="text/javascript">
google code
</script>
</HTML>

I put my google banner in the start.txt page, at the bottom...
Avatar
turnermm (Moderator) #7
Member since Oct 2009 · 4399 posts · Location: Canada
Group memberships: Global Moderators, Members, Super Mods
Show profile · Link to this post
In reply to post #5
It goes in data/pages.  You can get this file by opening it in your editor:  
http://mysite.com/mywiki/doku.php?id=sidebar

Put some sidebar items into it.  The the sidebar footer will also appear.
Myron Turner
github: https://github.com/turnermm
plugins, templates: http://www.mturner.org/devel
Avatar
tester00125 #8
Member since Jan 2015 · 9 posts
Group memberships: Members
Show profile · Link to this post
In reply to post #6
Thank you Torpido and turnermm.

This problem happen because I'm stupid.  I just insert <html> and </html> into my sidebar page as you suggest it's look like work fine.  Now sidebar has show, but Ads is disappear.

[Image: http://i725.photobucket.com/albums/ww251/tester00125/8585_zpsimfbfdst.png]
Avatar
Torpedo #9
Member since Aug 2014 · 81 posts
Group memberships: Members
Show profile · Link to this post
I've just made a try with my google's banner and it works fine! I've put my google's code after my Dokuwiki's code, in the sidebar.txt.

The only thing that I want to suggest you (if you want to put your ad in the sidebar) is to use a banner with width not greater than 160 px (for example 160x600 is a good choice).

For example:

  * dokuwiki link 1
  * ...
  * dokuwiki link n

---

<HTML>
<script type="text/javascript">
/* <![CDATA[ */
document.write('<s'+'cript type="text/javascript" src="YOUR-PATH/js2.ad/size=160X600/r='+new Date().getTime()+'"><\/s'+'cript>');
/* ]]> */
</script>
</HTML>

----
Edit:
I want point out that my solution doesn't provide the use of googleads plugin. Simply allow html in your DW and than past the google code, between <HTML> tag, where you want to put your ads.

I've never used that plugin but, reading its section https://www.dokuwiki.org/plugin:googleads#About, it seems to me that there some configuration that you need to set up.
This post was edited 3 times, last on 2015-02-13, 13:59 by Torpedo.
Avatar
ach (Administrator) #10
Member since May 2006 · 1904 posts · Location: Folkestone, UK
Group memberships: Administrators, Members, Super Mods, Wiki Managers
Show profile · Link to this post
In reply to post #6
Quote by Torpedo on 2015-02-10, 20:50:
1) Configuration Setting > Allow embedded HTML
2) In my page *.txt I wrote:
<HTML>
<script type="text/javascript">
google code
</script>
</HTML>

Please don't advise people to use this without telling them that it opens a *security issue*!
Don't use this in open wikis, only use it when only a select number of people have edit rights. See also https://www.dokuwiki.org/config:htmlok
Avatar
Torpedo #11
Member since Aug 2014 · 81 posts
Group memberships: Members
Show profile · Link to this post
Oh, sorry! I beg your pardon!
That's an important remark!
Avatar
chongtin #12
Member for 3 months · 1 post
Group memberships: Members
Show profile · Link to this post
You might check this out, and see. It use the html hooks instead of hacking the dokuwiki core.

https://wiki.chongtin.com/doku.php?id=adding_google_adsense
Close Smaller – Larger + Reply to this post:
Verification code: VeriCode Please enter the word from the image into the text field below. (Type the letters only, lower case is okay.)
Smileys: :-) ;-) :-D :-p :blush: :cool: :rolleyes: :huh: :-/ <_< :-( :'( :#: :scared: 8-( :nuts: :-O
Special characters:
Go to forum
Imprint
This board is powered by the Unclassified NewsBoard software, 20150713-dev, © 2003-2015 by Yves Goergen
Current time: 2018-12-14, 04:48:22 (UTC +01:00)