PHP to display something in sNews ONLY when viewing an article on it's page

PHP to display something in sNews ONLY when viewing an article on it's page

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!";
}

Tags

 

You might like

Comments


Thanks Matt :)

The best blog about sNews!


Thanks!


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.


I would think your site has the potential to do very well with Adsense Philippe. You have a great niche site.


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.


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


Hi Andrew,

That can be done, I'll get back to you on Tuesday... I'm away in Washington D.C. until then.

-Matt


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!";
}


Matt, I've been offline myself for a few days. Just noticed your back! I'll give your code a try. Thanks very much!


Thanks, Matt, works awesome.

Comments are closed. No new comments allowed.

Copyleft 2002 - 2017 Matt Jones
Hand crafted with HTML5 & CSS3
↑ Back to top