PHP to display something in sNews ONLY when viewing an article on it's page
Apr 28th, 2009 at 2:20 pm
filed under: sNews CMS / Hacks & Mods
filed under: sNews CMS / Hacks & Mods
Here is a snippet of PHP code for sNews 1.7 to display something (image, text, anything) ONLY when viewing an article on it's stand alone page, not on the home page, regular pages, or category views.
if (empty($currentPage) && !empty($_ID) && $_catID > 0) {
echo "Sweet, this is an article page!";
} else {
echo "Damn, this isn't an article page!";
}
10 comments
Add a new comment »Categories
Recent Entries
Recent Comments
- Dede (I checked it today in a shop. GT2 had some troubles with six ...)
- Matt (Bintang, You need to re-direct the url, try ...)
- jesth (Ohh.. why didn't I think of that, thanks alot.)
- Matt (Dede, I don't have Gran Turismo 2, any of the 2nd+ generation ...)
- Matt (Jesth, Just change the if condition, instead of looking for ...)
- jesth (Hi (again) Was wondering, is it possible to make it ...)
- Bintang Sembilan (Matt, thanks for your modd. I have apply it to my ...)
- Dede (Hello there. Can you check something for me? I want to buy ...)
- Matt (I think it's a driver issue Terrence, or it was a driver issue. ...)
Popular Entries
- Light-weight related articles mod for sNews 1.7 (4.5/5)
- Image / math hybrid captcha version 2, vastly improved (4.42/5)
- 1024x600 netbook wallpapers of Evangeline Lilly (4.4/5)
- Compact archives for sNews 1.7 (4.4/5)
- sNews Ajax Polls mod now available (4.38/5)
- Pretty date and comments bars in sNews CMS (4.35/5)
- Page caching mod for sNews 1.7 (4.33/5)
- Gravatar mod for sNews 1.7 (4.29/5)
- An improved tag cloud for sNews 1.7 (4.29/5)
Apr 28th, 2009 at 6:03 pm
Thanks Matt :)
The best blog about sNews!
Apr 29th, 2009 at 1:07 pm
Thanks!
Apr 30th, 2009 at 3:07 am
Hi Matt,
really nice: I was wondering how I could display Google Ads too (later on) and tada! here comes the solution. Thanks a lot.
Have a nice day.
Apr 30th, 2009 at 6:26 am
I would think your site has the potential to do very well with Adsense Philippe. You have a great niche site.
Apr 30th, 2009 at 9:59 am
Thanks Matt for your encouragement.
But... but... this blog is just a playground for SEO and a way to let out the steam of my brain when I get ennoyed by customers.
I never done its promotion so there's a few visitors.
Jun 20th, 2009 at 12:42 am
Matt,
This mod seems to be almost exactly what I am looking for. If you have the time could you explain how I can get something to show on my articles (as above) and also the homepage. My homepage is always my latest article. The something being adsense of course.
Thanks again for getting me sorted with my missing data last week.
Best,
Andrew
Jun 20th, 2009 at 9:42 am
Hi Andrew,
That can be done, I'll get back to you on Tuesday... I'm away in Washington D.C. until then.
-Matt
Jun 23rd, 2009 at 7:32 am
Andrew, try this and see if it works for what you want;
if (empty($currentPage) && (!empty($_ID) && $_catID > 0 || empty($_GET['category']))) { echo "Sweet, this is an article/home page!"; } else { echo "Damn, this isn't an article/home page!"; }Jun 28th, 2009 at 6:09 pm
Matt, I've been offline myself for a few days. Just noticed your back! I'll give your code a try. Thanks very much!
Jan 22nd, 2010 at 1:26 pm
Thanks! I insert adsense in text example:
http://www.calun.pl/calun-turynski/calun-turynski-argumenty-nie/czy-znalezisko-podwazy-mit-calunu-turynskiego/