First off let me say I love CMSMS - just downloaded it yesterday and already have a fairly complex website developed on my PC.
My question is concerning the News module (version 2.9.2) running on CMS version 1.5.2, specifically the Browse Category option called with the command: {news browsecat="1"} - using the default Browse Category template.
I only have a single level of categories, but we do preload news/announcements that have a specific start and end date. The summary display works as expected - only showing those articles that were designated to start before today. (I can't verify the end date yet - since the system seems to always force the article to be up for a minimum of 6 months from the date entered which seems to be another issue).
When I use the above command to display just the browse categories it shows the number of items in each category - regardless of whether it is within the start-end time frame. Therefore if I have an article preloaded to announce a future meeting in July but I don't want to start displaying it on the web until June - the Summary display correctly doesn't show it, but the Browse Category display indicates that category has an entry. When you click the link to display it from the Browse Category list you get a "null" screen (nothing displayed). I have searched this forum to see if someone has already answerd this to no avail.
I've perused the other News templates to see if I could discern what is restricting display to those between the start-end dates but I don't see the use of the {$entry->startdate} field. I can't quite believe that I'm the first person to notice this quirk. Is there anyone else out there that has resolved this issue?
Thanks
[solved] News module - Browse Category Template question
- forest-guy
- Forum Members
- Posts: 32
- Joined: Fri Jan 23, 2009 11:10 pm
- Location: Albuquerque, New Mexico, USA
[solved] News module - Browse Category Template question
Last edited by forest-guy on Tue Jan 27, 2009 11:15 pm, edited 1 time in total.
Re: News module - Browse Category Template question
Welcome forest-guy -
If I remember off the top of my head you'd want to do some thing like {if $entry->postdate|cms_date_format eq *the time frame*} {/if}
I don't have time to fully look but if no one gets back I'll check later...
Cheers
jeremyBass
If I remember off the top of my head you'd want to do some thing like {if $entry->postdate|cms_date_format eq *the time frame*} {/if}
I don't have time to fully look but if no one gets back I'll check later...
Cheers
jeremyBass
- forest-guy
- Forum Members
- Posts: 32
- Joined: Fri Jan 23, 2009 11:10 pm
- Location: Albuquerque, New Mexico, USA
Re: [solved] News module - Browse Category Template question
Thanks Jeremy but the solution isn't in the template. The template only can refer to the fields already pulled out by the SQL query which was occuring in action.browsecat.php around line 48. Originally it was:
$q2 .= " AND ((".$db->IfNull('end_time',$db->DBTimeStamp(1))." = ".$db->DBTimeStamp(1).") OR (end_time > ".$db->DBTimeStamp(time()).")) ";
You'll notice that although the query handles articles that are expired in the above, nowhere does it address the articles that haven't started yet. So I made the following modification to the original code:
$q2 .= "AND ((start_time DBTimeStamp(time()).") AND ((".$db->IfNull('end_time',$db->DBTimeStamp(1))." = ".$db->DBTimeStamp(1).") OR (end_time > ".$db->DBTimeStamp(time()).")))";
Now items show in the browse category display if they are actually supposed to display.
$q2 .= " AND ((".$db->IfNull('end_time',$db->DBTimeStamp(1))." = ".$db->DBTimeStamp(1).") OR (end_time > ".$db->DBTimeStamp(time()).")) ";
You'll notice that although the query handles articles that are expired in the above, nowhere does it address the articles that haven't started yet. So I made the following modification to the original code:
$q2 .= "AND ((start_time DBTimeStamp(time()).") AND ((".$db->IfNull('end_time',$db->DBTimeStamp(1))." = ".$db->DBTimeStamp(1).") OR (end_time > ".$db->DBTimeStamp(time()).")))";
Now items show in the browse category display if they are actually supposed to display.
Last edited by forest-guy on Tue Jan 27, 2009 11:39 pm, edited 1 time in total.
Re: [solved] News module - Browse Category Template question
Glad you found a way... I only did it in the template so I didn't need to worrie about updates... Would be nice If I didn't have to do it but oh well...
Cheers
jeremyBass
Cheers
jeremyBass
Re: [solved] News module - Browse Category Template question
May-be this is something you'd want to put in to the bug reports...
http://dev.cmsmadesimple.org/bug/list/8
Cheers
jeremyBass
http://dev.cmsmadesimple.org/bug/list/8
Cheers
jeremyBass