Welcome to Geeklog, Anonymous Thursday, April 18 2024 @ 08:56 pm EDT

Geeklog Forums

limitnews setting bug


Status: offline

samstone

Forum User
Full Member
Registered: 09/29/02
Posts: 820
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


 Quote

Status: offline

jmucchiello

Forum User
Full Member
Registered: 08/29/05
Posts: 985
What did you expect it to do?
 Quote

Status: offline

Dirk

Site Admin
Admin
Registered: 01/12/02
Posts: 13073
Location:Stuttgart, Germany
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
 Quote

Status: offline

jmucchiello

Forum User
Full Member
Registered: 08/29/05
Posts: 985
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.
 Quote

Status: offline

samstone

Forum User
Full Member
Registered: 09/29/02
Posts: 820
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
 Quote

Status: offline

jmucchiello

Forum User
Full Member
Registered: 08/29/05
Posts: 985
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).
 Quote

Status: offline

samstone

Forum User
Full Member
Registered: 09/29/02
Posts: 820
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
 Quote

Status: offline

Dirk

Site Admin
Admin
Registered: 01/12/02
Posts: 13073
Location:Stuttgart, Germany
Quote by: samstone

For 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
 Quote

Status: offline

samstone

Forum User
Full Member
Registered: 09/29/02
Posts: 820
Thanks, Dirk!

Sam
 Quote

Status: offline

Dirk

Site Admin
Admin
Registered: 01/12/02
Posts: 13073
Location:Stuttgart, Germany
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
 Quote

All times are EDT. The time is now 08:56 pm.

  • Normal Topic
  • Sticky Topic
  • Locked Topic
  • New Post
  • Sticky Topic W/ New Post
  • Locked Topic W/ New Post
  •  View Anonymous Posts
  •  Able to post
  •  Filtered HTML Allowed
  •  Censored Content