Welcome to the MetaMod and Chameleon Support Forums.

Before posting, please check out the FAQs.

helpme

 

Need extra help with your Joomla site? Consider paid Joomla support by the developer of Chameleon and MetaMod.

 

Can MetaMod do this?

Can MetaMod do this?

Hi,

Currently, I have this newsticker module that I'm using. I use it to display "Breaking News". Whenever there's a breaking news story, I created an article and put in an category for breaking news stories. The newsticker module displays that stories. The problem that I'm having is that when the stories are removed, the module remains.

I want to be able to disable the module when the stories are removed. Can Metamod do this? If so, can anyone provide a recipe for it? If not, can anyone suggest an alternative way to handle my situation?

Thanks for your help.


sancho

sancho
Beginner Modder
ranks
useravatar
Offline
1 Posts
Administrator has disabled public posting

Re: Can MetaMod do this?

Hi Sancho,

I think you're saying something like "I only want to display the module if we know that there are published articles in a certain category" (the breaking news category).

That should be pretty simple:

$catid = 1; // change this to the category id of breaking news
$nullDate    = $db->Quote( $db->getNullDate() );
$jnow        =& JFactory::getDate();
$now        = $db->Quote( $jnow->toMySQL() );

$query = "select count(*) from #_"
  . "_content a where catid = $catid and state = 1
  and ( a.publish_up = $nullDate OR a.publish_up <= $now )
  and ( a.publish_down = $nullDate OR a.publish_down >= $now )";
$db->setQuery( $query );
$count = $db->loadResult();

if ($count) return XXX;
// replace XXX with the module id of the news ticker module.


Cheers,
Stephen

Stephen Brandon
MetaMod / Chameleon developer
If you use MetaMod or Chameleon, please post a rating and a review at the Joomla! Extensions Directory: Chameleon | MetaMod

metamodguy
useravatar
Offline
3313 Posts
User info in posts
Administrator has disabled public posting

Board Info

Board Stats:
 
Total Topics:
1679
Total Polls:
6
Total Posts:
5913
Dormant:
User Info:
 
Total Users:
10746
Newest User:
victor1234
Members Online:
0
Guests Online:
180

Online: 
There are no members online

Forum Legend:

 Topic
 New
 Locked
 Sticky
 Active
 New/Active
 New/Locked
 New Sticky
 Locked/Active
 Active/Sticky
 Sticky/Locked
 Sticky/Active/Locked