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!";
}
Share or Bookmark This Post:


Comments

RSS Comments Feed


alyoung's Avatar

alyoung

Thanks Matt :)

The best blog about sNews!

jordi's Avatar

jordi

Thanks!

Sven - Philippe's Avatar

Sven - Philippe

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.

Matt's Avatar

Matt

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

Sven - Philippe's Avatar

Sven - Philippe

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.

AJ's Avatar

AJ

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

Matt's Avatar

Matt

Hi Andrew,

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

-Matt

Matt's Avatar

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

Andrew's Avatar

Andrew

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

Nicu Alecu's Avatar

Nicu Alecu

Thanks, Matt, works awesome.




(optional, not publicly displayed)


(optional)

Subscribe

RSS Feed

Archives

Powered by HTML5

HTML5 Powered with CSS3 / Styling, Multimedia, and Semantics