Need extra help with your Joomla site? Consider paid Joomla support by the developer of Chameleon and MetaMod.
- Index
- » MetaMod
- » MetaMod General Support
- » Can MetaMod do this?
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
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
- Index
- » MetaMod
- » MetaMod General Support
- » Can MetaMod do this?
Board Info
- Board Stats:
- Total Topics:
- 1689
- Total Polls:
- 6
- Total Posts:
- 5943
- Posts this week:
- 2
- User Info:
- Total Users:
- 7642
- Newest User:
- mary26
- Members Online:
- 0
- Guests Online:
- 190
- 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