Posted on: 07/27/07 02:53am
By: samstone
If I set limitnews to 0 (zero), in config.php, I got an error saying something like "division by zero," related to line 218 of index.php.
Would this considered be a bug?
Sam
Re: limitnews setting bug
Posted on: 07/27/07 09:41am
By: jmucchiello
What did you expect it to do?
Re: limitnews setting bug
Posted on: 07/27/07 02:00pm
By: Dirk
0 doesn't make a lot of sense for that setting, since it's supposed to be the number of stories per page. It shouldn't cause an error like that, though. So I guess at least that should be fixed.
bye, Dirk
Re: limitnews setting bug
Posted on: 07/27/07 03:17pm
By: jmucchiello
That's why I asked what he expected it to do. There are two possible (and reasonable) expectations: 1) Display no stories and 2) Display all stories on one page. Personally, if either (or both) of these conditions were to be added, I'd rather see them added as text:
$_CONF['limitnews'] = 'all'; // or 'none' or a number representing the number of stories per page.
Then the story code could check for 'none' and 'all' up front and act accordingly.
But that's a feature request. Divide by zero is a bug and should default gracefully.
Re: limitnews setting bug
Posted on: 07/27/07 03:24pm
By: samstone
Yes, I just think at least it should not throw an error.
I agree that zero story doesn't make sense. But I was trying to control the content of the front page by having a stack of php staticpages to display what I want them to display, and not to have stories of a random topic appear on the front page.
What I have in mind is, for example, I have 5 topics and I want 5 latest stories on the front page from each topic. So I created 5 center blocks (or simply 1) staticpages with custom php returning the latest story from each topic.
I know I can set "Show only on topic" as default. But there are too many older stories to change the settings. So I tried to eliminated stories entirely from the front page. So far I can only configure it to one story because zero generates error.
What is the best alternative. Commenting out "Display first article" and "get remaining stories" sections from the index.php? Will this create any problem?
BTW, would a feature request for a config option to set "No stories on the front page" make sense?
Thanks,
Sam
Re: limitnews setting bug
Posted on: 07/27/07 05:27pm
By: jmucchiello
Sure it makes sense if you are going to use it.
Personally, all of the story options in config should be mirrored in the topics so you could have each topic work differently but I have far too much going on to tackle playing with the topics code.
For example, it would be cool if stories was a plugin and you could attach the stories to topics, just like a static page is attached to a topic. You could then have topics with no stories (and the topic NEVER shows up in the topic list when you are submitting a new story).
Re: limitnews setting bug
Posted on: 07/28/07 03:14pm
By: samstone
What is the best alternative. Commenting out "Display first article" and "get remaining stories" sections from the index.php? Will this create any problem?
For the time being, would this hack serve the purpose?
Sam
Re: limitnews setting bug
Posted on: 07/28/07 05:49pm
By: Dirk
Quote by: samstoneFor the time being, would this hack serve the purpose?
Setting all the existing stories to "show only in topic" would be easier:
Text Formatted Code
UPDATE gl_stories SET frontpage = 0;
bye, Dirk
Re: limitnews setting bug
Posted on: 07/28/07 07:54pm
By: samstone
Thanks, Dirk!
Sam
Re: limitnews setting bug
Posted on: 08/04/07 02:35pm
By: Dirk
This has since been fixed in CVS, btw. It now makes sure that 'limitnews' is at least 1, thus avoiding the division by zero.
bye, Dirk