Welcome to Geeklog, Anonymous Thursday, December 26 2024 @ 08:06 pm EST
Geeklog Forums
Headlines block for ONE topic
Status: offline
Dirk
Site Admin
Admin
Registered: 01/12/02
Posts: 13073
Location:Stuttgart, Germany
Text Formatted Code
$result = DB_query ("SELECT title,sid FROM {$_TABLES['stories']} WHERE tid = 'YourTopicIDhere' ORDER BY date DESC LIMIT 10");$numrows = DB_numRows ($result);
$retval = '';
for ($i = 0; $i < $numrows; $i++) {
$A = DB_fetchArray ($result);
$retval .= '<a href="' . COM_buildUrl ($_CONF['site_url'] . '/article.php?story=' . $A['sid']) . '">' . $A['title'] . '</a><br>';
}
Something like this? I can almost write that in my sleep - which means that it may have a few typos or syntax errors - completely untested ...
It's also missing any permission checks.
bye, Dirk
5
10
Quote
Status: offline
xardoz
Forum User
Regular Poster
Registered: 02/24/04
Posts: 98
Success!!!
I tried just using your code, and there were some errors, as you predicted. But this helped me understand what the standard "headlines" block is doing.
I copied the standard "headlines" code, gave it a new phpblock_name and added your
as an AND () statement to the WHERE condition.
As always, Dirk comes through with the good stuff.
Thanks for all your help!
I tried just using your code, and there were some errors, as you predicted. But this helped me understand what the standard "headlines" block is doing.
I copied the standard "headlines" code, gave it a new phpblock_name and added your
Text Formatted Code
tid = 'YourTopicIDhere'As always, Dirk comes through with the good stuff.
Thanks for all your help!
7
9
Quote
All times are EST. The time is now 08:06 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