Print news link only when news is present and published

fretzl Administrator, Developer
Scenario:
A menu with a "News" link to news.php.
This link is wrapped in some HTML.
What I'd like is: to not print the HTML/News-link if there is are no news-tems or only unpublished news-items.

Any tips ?

Comments

  • acrylian Administrator, Developer
    If using the official menus, no way without modifiying. If a custom (static) menu try `getNumNews()`. It uses the class method getArticles/getCombiNews internally so it should not return unpublished items unless - as alway - loggedin with the appropiate rights.
  • fretzl Administrator, Developer
    Thanks. I'll give it a try.
  • fretzl Administrator, Developer
    Works great!
    `if(getNumNews(true) > 0) {....}`
  • acrylian Administrator, Developer
    I guess, If not you would have had found a bug..;-)
  • vincent3569 Member, Translator
    Hi
    btw, in zpArdoise, I only use
    `if (getNumNews() > 0) {...}`
Sign In or Register to comment.