Show News articles by date

For questions and problems with the CMS core. This board is NOT for any 3rd party modules, addons, PHP scripts or anything NOT distributed with the CMS made simple package itself.
Post Reply
antony_s
New Member
New Member
Posts: 8
Joined: Mon Jul 06, 2009 1:32 pm

Show News articles by date

Post 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.
Jeff
Power Poster
Power Poster
Posts: 961
Joined: Mon Jan 21, 2008 5:51 pm

Re: Show News articles by date

Post 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
antony_s
New Member
New Member
Posts: 8
Joined: Mon Jul 06, 2009 1:32 pm

Re: Show News articles by date

Post 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.
antony_s
New Member
New Member
Posts: 8
Joined: Mon Jul 06, 2009 1:32 pm

Re: Show News articles by date

Post 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.
User avatar
blast2007
Power Poster
Power Poster
Posts: 508
Joined: Wed Aug 01, 2007 5:36 pm

Re: Show News articles by date

Post 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
antony_s
New Member
New Member
Posts: 8
Joined: Mon Jul 06, 2009 1:32 pm

Re: Show News articles by date

Post 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.
User avatar
blast2007
Power Poster
Power Poster
Posts: 508
Joined: Wed Aug 01, 2007 5:36 pm

Re: Show News articles by date

Post by blast2007 »

This is the link:

http://forum.cmsmadesimple.org/index.ph ... 969.0.html

Read entire post for explanation
antony_s
New Member
New Member
Posts: 8
Joined: Mon Jul 06, 2009 1:32 pm

Re: Show News articles by date

Post 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.
calguy1000
Support Guru
Support Guru
Posts: 8169
Joined: Tue Oct 19, 2004 6:44 pm

Re: Show News articles by date

Post 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.
Follow me on twitter
Please post system information from "Extensions >> System Information" (there is a bbcode option) on all posts asking for assistance.
--------------------
If you can't bother explaining your problem well, you shouldn't expect much in the way of assistance.
User avatar
blast2007
Power Poster
Power Poster
Posts: 508
Joined: Wed Aug 01, 2007 5:36 pm

Re: Show News articles by date

Post 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
Post Reply

Return to “CMSMS Core”