Page 1 of 1
Show News articles by date
Posted: Mon Jul 06, 2009 1:36 pm
by antony_s
Hi,
I am new to CMSMS and have found it simple to put a site together, but there are a few puzzling design decisions, or features I am unaware of.
One of them is the ability to display news articles by date - I have done some searching on the forum and there seems to be no documentation on doing this - yet it seems such a common thing to want to achieve?
My client would like a menu down the left-hand side of the screen with options for each month of the year. When you click the month, you'll see the articles from that month - yet I can't find out how to do this! Any help would be greatly appreciated.
Re: Show News articles by date
Posted: Mon Jul 06, 2009 4:03 pm
by Jeff
Well if you looked in the help for the News module you would find:
# (optional) sortasc="true" - Sort news items in ascending date order rather than descending.
# (optional) sortby="news_date" - Field to sort by. Options are: "news_date", "summary", "news_data", "news_category", "news_title", "news_extra", "end_time", "start_time", "random". Defaults to "news_date". If "random" is specified, the sortasc param is ignored.
As for the months, there is a "archive" option, but if you want it as a select box with options then you probably will need to write a UDT for that.
Jeff
Re: Show News articles by date
Posted: Mon Jul 06, 2009 4:12 pm
by antony_s
I saw that in the very short Help page - and realised it wasn't what I was looking for.
It's not a big ask to have a menu split by date, and I'm really surprised the news module doesn't seem to have this option built in.
Re: Show News articles by date
Posted: Tue Jul 07, 2009 2:24 pm
by antony_s
Just wondering if anyone knows how to do this.
For example, I would like a list of options:
July 2009
June 2009
May 2009
April 2009
and so on...
Making the links isn't a problem - knowing how to get {news} to show the articles however, is! Any help would be greatly appreciated.
Re: Show News articles by date
Posted: Tue Jul 07, 2009 2:32 pm
by blast2007
Very simple. Just apply a free
patch.
If you want to merge the patch in the core you have to pay/pray developers (as sponsor).
regards
blast
Re: Show News articles by date
Posted: Tue Jul 07, 2009 4:02 pm
by antony_s
Hi Blast - thanks for this. Only problem is, when I click the link:
The page you were looking for doesn't exist.
You may have mistyped the address or the page may have moved.
Re: Show News articles by date
Posted: Tue Jul 07, 2009 4:03 pm
by blast2007
Re: Show News articles by date
Posted: Fri Jul 17, 2009 2:42 pm
by antony_s
Okay let's cut through the politics and save people from a LOT of reading in the future. I have made available the merged files below for anyone else wanting to do this.
First of all download
http://www.asdsolutions.co.uk/files/news_update_v2_9.zip and extract the files. Then, in your CMS Made Simple installation, replace the following files with the ones you just extracted:
/modules/News/News.module.php
/modules/News/action.default.php
/modules/News/lang/en_US.php
Note - the merge was performed on
version 2.9 bundled with CMS Made Simple at the time of posting.
The changes are those made by blast2007 originally and
are minor and will not break the news module! However proceed at your own risk, as we have had the lectures that any amendments will render the module
unsupported.
To use, simply call the News module like this:
Code: Select all
{news startperiod="2009/07/01" endperiod="2009/07/31"}
This would show all the articles from July 2009.
I am going to work on a menu that automatically renders based on a start month/year and the current month/year, and will post a link once the code is ready - shouldn't be too long.
I hope this helps even one person using CMS Made Simple's News module and saves a lot of reading in the forums to accomplish something quite simple.
If I have broken any rules in posting this - feel free to moderate / delete.
Re: Show News articles by date
Posted: Fri Jul 17, 2009 4:19 pm
by calguy1000
Anybody applying these patches please keep in mind that they are UNSUPPORTED... and therefore we cannot support any of your questions after you've hacked the code.
If you apply your own patches to the code, so be it.. it is therefore expected that you're proficient enough with PHP and system to solve your own difficulties from then on in.
Re: Show News articles by date
Posted: Fri Jul 17, 2009 4:32 pm
by blast2007
Considering the "difficulties" to integrate period patch in news module,
here you can find how to achieve same results with vanilla news core files (no patch is needed).
regards
blast