News Module Can Cause Internal Server 400 Errors

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.
Locked
gazoo

News Module Can Cause Internal Server 400 Errors

Post by gazoo »

Hello all,

One of my CMSMS v.0.13 sites has approximately 1200 news articles split into multiple categories (organized by month).

When I attempted to add an additional news article, I received an Internal Server Error 400 and was unable to edit any news items thereafter.

Recognizing that this particular 400 Error meant a timeout error, as a test, I used phpMyAdmin to edit the backend database and removed about 100 news items. I was then able to administer the news articles from the CMSMS Admin Panel. When I replaced the 100 news items I previously deleted, I received the same error when I attempted to administer the news articles from the CMSMS Admin panel.

The reason for this error is that by default, when you go to administer the news items, CMSMS attempts to display ALL the news articles. Since in my case I have over 1200 articles, the server timed out and gave me the 400 Error.

I implemented a quick fix to this by hacking the \modules\News\action.defaultadmin.php file. Specifically, I appended the SQL  LIMIT directive to the end of line 103 (to cap 'All Articles' to the 100 most recent articles and avoid a timeout error).

Code: Select all

$query = "SELECT n.*, nc.long_name FROM ".cms_db_prefix()."module_news n LEFT OUTER JOIN ".cms_db_prefix()."module_news_categories nc ON n.news_category_id = nc.news_category_id ORDER by news_date DESC LIMIT 0, 100";
The same could be done to line 91 if your news categories also have lots of articles.

However, ideally, what is required is a pagination routine to display the news articles in the admin section.

Daniel15 posted some excellent code in his post (http://forum.cmsmadesimple.org/index.php/topic,10188.0.html) for pagination of news articles on the front-end. Is there a way a similar routine can be adapted for pagination of news articles in the backend/admin area?

Thanks!
Gazoo
gazoo

Re: News Module Can Cause Internal Server 400 Errors

Post by gazoo »

Thanks for your reply. I'm using News Module version 2.0.3 under CMSMS v.0.13.

I took at the Help as well and noticed calguy's note about pagination. Don't know what this refers to as I don't see any pagination links when administering the news articles. Furthermore, I don't see any options to control pagination (i.e., like number of articles per page, etc.). Perhaps the "pagination" calguy's refering to is the use of tabs for "Articles", "Categories", "Summary Template", "Detail Template", and "Options"?

Furthermore, although I'm no PHP expert, it would appear that \modules\News\action.defaultadmin.php contains the code for displaying the news articles in the News Module admin. And I definitely don't see any routines for pagination in this file.

Perhaps calguy can shed some light on this issue/request as well.
User avatar
Elijah Lofgren
Power Poster
Power Poster
Posts: 811
Joined: Mon Apr 24, 2006 1:01 am

Re: News Module Can Cause Internal Server 400 Errors

Post by Elijah Lofgren »

I'm going to try to create a patch that adds pagination to news (frontend and backend).
I plan to use code from the Questions module.

Hopefully it won't take long. :)
Note: I don't have time to take on any more projects. I'm quite busy. I may be too busy to reply to emails or messages. Thanks for your understanding. :)
User avatar
Elijah Lofgren
Power Poster
Power Poster
Posts: 811
Joined: Mon Apr 24, 2006 1:01 am

Re: News Module Can Cause Internal Server 400 Errors

Post by Elijah Lofgren »

Daniel15 wrote:
Elijah Lofgren wrote: I'm going to try to create a patch that adds pagination to news (frontend and backend).
I plan to use code from the Questions module.

Hopefully it won't take long. :)
Nice, I can't wait :)
I'd love to see Month-based pagination (each month has a seperate news page) :D
I've decided not to work on getting my News Pagination code working.....
But... I've decided to try to get Pagination working on the Calendar Admin instead. Why? Well..... Calendar (SVN version) makes a great blog module! :)  :o  :D

See this post: http://forum.cmsmadesimple.org/index.ph ... 487.0.html

P.S. So I'll hopefully work on backend Calendar event Pagination instead (might be Spring break before I do though).
Note: I don't have time to take on any more projects. I'm quite busy. I may be too busy to reply to emails or messages. Thanks for your understanding. :)
Locked

Return to “CMSMS Core”