Can I wrap Adsense code in PHP to omit adsense from specific webpages? - adsense

I am using an instance of mediawiki and have added adsense to the php file of the skin. This places the adsense banner on all pages but I would like to omit the adsense banner from very specific pages.Primarily the "homepage" (but keep adsense on all the other pages). My site is really big so going in the other direction (adding adsense to specific pages) would be a huge pain.
I was hoping there was a bit of PHP code I could wrap the adsense code in that would allow me to specify URLS for the adsense to ignore.
Thank you.

I'm not a programmer so I have no idea what you just said.
However, This article answered my question:
http://forum.dreamhosters.com/3rdparty/29149-MediaWiki-and-Google-AdSense.htm
I just added the "Main Page" (homepage) to the list of omitted pages in the list.
Example:
!strstr($_SERVER['REQUEST_URI'], "Main_Page") &&
THanks anyway.

Make an array of the pages to omit, then check the server environment variable REQUEST_URI to see if it's in the array?
If strstr works OK for you, fine. The way I mentioned would probably be coded:
!(in_array($_SERVER['REQUEST_URI'], array("/Main_page", "/some/other/page", "/no_ads.html")) &&
I rarely use PHP any more, otherwise I would have provided code at the time. I just get onto stackoverflow when I run into snags in my own coding, and try to offer hints when I can. Sometimes they help, sometimes they don't.

You can just use the AdSense extension and hide the ads on specific pages with custom CSS.
Or you can use a specific AdSense extension which already hides the ads where you want, namely the main page.

Related

How to display ALL Facebook Comments on my Blog in ONE place?

Yes, before you ask, I need to clarify that I looked a possible
solution up but that wasn't what I'm trying to achieve.
What I really wan't to do cannot be explained in a few words so I'm going to give a short verbose explaination.
Like this familiar interface of comment-tool in facebook's developer site , I want to be able to see people/pages commenting on my different posts(webpages) in a single static page onmy website.(Pictures below):
Image-1: Comment-tool interface on developers.facebook.com
Image-2: Image of people commenting on some webpage displayed beside their name... and subsequent comments on different webpages following it
Ofcourse, I could use the comment-tool present in developers.facebook.com but that gives me access to me and my collaborators only. I need any visitor to be able to see what people are commenting on different posts, in a single page.
Since, this feature is already an option for comment-tool/app admins and moderators, I stand within reason to think that there must be some way to do this publicly too!
tl;dr version:
I want to bring the comment-tool interface found in developer.facebook.com to a webpage on my blog. Can anyone help me? I might drop a bounty if I really like your soultion :)

confluence display content by user

I am trying to get specific content on a confluence cloud wiki to display content based on a specific user. The scenario here is that there are links on a page but only 1 should display, the one that displays is based on whom ever is logged in.
I have been told how a macro is the way forward, but I have read the documentation and I am at a loss. I do not understand what I have to do or how to write a confluence macro. could someone help me out with either an example or some links? I have searched like crazy, but maybe i am not asking the right questions but hopfully you can all help me out?
There's a plugin for this:
https://marketplace.atlassian.com/plugins/net.customware.confluence.plugin.visibility
But I'm not sure how thoroughly it hides the content. It might still be visible if users view the page source. If you're trying to hide content which needs to be really protected, you'll probably need to do something else.
Depending on how many users are going to be using the page, you could also just make separate spaces for them, add the permissions to those spaces, and then use a page-include on your "main" page to display the content. If they don't have access it shouldn't show up. You might experience some formatting issues with that solution, however.
Finally, you could grab the username with jquery and display stuff based on that. This solution will be pretty easy if you are familiar with javascript/jquery.
Edit: Here are some helpful resources on how to use javascript and jquery within confluence:
https://confluence.atlassian.com/display/CONFKB/How+to+Use+JavaScript+in+Confluence
https://developer.atlassian.com/confdev/confluence-plugin-guide/writing-confluence-plugins/including-javascript-and-css-resources

reloading the soundcloud html widget with different sets from links

I was advised to post this here by SoundCloud support - I hope you can help. I want to use the html5 widget on my site and access different sets but, rather than have multiple widgets on a page, I want to be able to reload the widget with a different set by clicking on different links on the page. It seems you can do this using the API and I have been playing with w.soundcloud.com/player/api_playground.html and have got it to load my sets by putting the api.soundclound.com url in the appropriate box and clicking "reload widget".
I really don’t know javascript at all so I was hoping to copy the source from that page and try and edit it to do what I want. However, I can’t even get the page to load when it is hosted on my site:
http://www.indigomusic.co.uk/SCtest/playground.htm
I downloaded api.js and put it in a folder on my server but I’m obviously missing step(s). I’ve read http://developers.soundcloud.com/docs/html5-widget#introduction but it obviously assumes a level of javascript knowledge that I just don’t have...
...are you able to help?
Many thanks,
Dan Selby
You don't have do use the Widget API for that necessarily.
Here is a simple example using jQuery and the SoundCloud SDK doing what you described:
http://dl.dropbox.com/u/12477597/Temporary/dynamic-widget-example.html
Hope it Helps.

Can Facebook/Google cause site to not load?

This might sound like a silly question, but yesterday none of our sites would load. After contacting the hosting company they said that
In this instance, it would appear that your site is hanging waiting for a response from an external component / website (looking at your code, I see references to Facebook, Google and online apps at a glance).
We've never had this problem before and the sites have been using the social plugins for months so I wondered if anybody else experienced this problem yesterday?
Thanks
Without knowing the details, I can tell you that when you load Javascript via <script></script> tags the browser waits for the request to finish before moving on. So, if you load JS files in the <head></head> section, nothing will render on-screen until they load successfully. 404s here will kill you, as will slow connections.
If you have in-line JS, it's best to put it at the very bottom of your <body></body> section so that it does not interrupt browser rendering. Do this for JS files in your <head></head> section if your code architecture allows it.
Just a random stab in the dark but I wonder if this was related in any way to the anonymous threats on Facebook. I have experienced similar problems before with a twitter plugin, it could take a few seconds for the plugin to ping back the tweets and the rest of the page was hanging while twitter was doing their thing.
To ensure this doesn't happen again you could call your social plugin's on page load if its a viable solution. At the end of the day do you want your page load time to depend on other services outside of your control or not?
edit: #Jason McClellan 's answer is spot on. I believe the combo of out answers sort out your question. I Never include script in the head if I don't control the resource! That can indefinitely hang your page.
edit2: Don't know why I'm getting down rated for this answer was just trying to relate it to an experience of mine. I'm not extremely experienced with Facebook plugins but when I was noticing an issue with my twitter plugin, I did exactly what #Jason McClellan has said with his answer to make sure that all your html gets rendered before the scripts are even requested, then ensured that the page could display correctly with or without the twitter content so the user experience was not dependant on an external resource. The twitter plugin I was using had an initiation function which I had to call to fire up the script. The simplest way to call this would be with:
<body onload='init()'>
if you have another script you are loading with the page you could use something along the lines of
window.onload = function() {
init();
}
from within your external script.
Sorry I can't give an answer specific to the Facebook plugin. Maybe someone with more experience in the Facebook plugins could elaborate in the comments :D
edit3: also this community based tool suggests that quiet a few people where seeing a bit of facebook downtime when you experienced it - Facebook status at DownRightNow
edit4: I dont have the "Privelages" to comment on Jason's q as im pretty new here ... but in answer to your comment there, the stuff in the head that you describe is what loads in the schema for facebook mark-up language (fbml) , so a mark-up language like html, but geared up for you to use the facebook api. So you can do stuff like:
<fb:comments xid="titans_comments" canpost="true" candelete="false" returnurl="http://apps.facebook.com/myapp/titans/">
<fb:title>Talk about the Titans</fb:title>
</fb:comments>
To wack some comments straight into your page - fbml developers guide
Your comment there also suggests you are not including a script for your page to load so it renders our previous answers not as important, you need to include the fbml stuff in the head before you use fbml in your page so don't move it :D
but #jason McClellan's answer is something that everyone should do on their project (unless there is a reason not to) as it allows for the user to see something before the browser fires off requests for the scripts. At the end of the day we're in this game to make pretty stuff for our users!
Good luck

How does the Google adsense works?

can you tell me, how does the Google Ad sense works?
please explain me in brief..
There's quite a bit of information available from Google on the subject.
You want to know how to "use" it? or its algorithms? For the first one, they have a page for that, for the later one, I don't think you will even be able to figure it out:)
You place a javascript code in your site, and whenever someone visits your site, Google puts an ad in place. If the user clicks the add, you get money for it.
I assume your question is orientated around Google's contextual targeting.
In brief: Google sends a bot to read each page of your website. It looks at all the terms on the page and discards common words and instead tries to understand themes. Google also looks at adgroups of AdWords advertisers and looks to build an understanding of the themes of the keywords. Another algorithm pairs the two together so that relevant ads appear on a webpage.