Welcome to Geeklog Friday, May 29 2020 @ 10:20 am EDT

Geeklog Forums

Feature Block w/ Headline Static Page underneth?


MarkB

Anonymous
I've got a lot of stories coming in and I have one featured, but I'd like to list the others in a static page, after the featured article. I have PHP enabled and all that stuff, but I'm at a loss as to where to start.

Anyone done anything like this before?

I've got my PHP/MySQL book that I'm starting to pour through, but any pointers would be great...

ideally I'd like to show the headline of stories submitted in the last 14 days where feature_stroy = no (if that makes sense)
 Quote

Status: offline

mrb42

Forum User
Junior
Registered: 15/10/04
Posts: 20
PHP Formatted Code
    $result = DB_query("Select sid, title,date FROM {$_TABLES['stories']} ORDER BY date DESC");
    $nrows = DB_numRows($result);
    for ($i = 1; $i <= $nrows; $i++) {
        $A = DB_fetchArray($result);
        $retval = '<a href="' . $_CONF['site_url'] . '/article.php?story=' . $A['sid'] . '">' . $A['title'] . ' - ' . $A['date'] .  '</a><BR>';
}
    return $retval;

 



I'm getting a return, but it's not looping. It's basiclly giving me one article and the query should return all of the stories (right?)

on a side not, it's not returning the entire page, just the query result and the footer. I have it check to wrap in a block... not sure if that's because the query isn't working or what...
 Quote

tokyoahead

Anonymous
You have to do $restval.= instead of $retval= inside the loop.
If you would have taken a closer look at the one result you would have seen that its always only giving you the last result. This indicates that it loops well but the output is assemled incorrent.
 Quote

Status: offline

mrb42

Forum User
Junior
Registered: 15/10/04
Posts: 20
thanks! That was it!
 Quote

All times are EDT. The time is now 10:20 am.

  • 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