Welcome to Geeklog, Anonymous Thursday, November 21 2024 @ 02:24 pm EST
Geeklog Forums
Trying to exclude archive from site feed.
Status: offline
matthewcox
Forum User
Junior
Registered: 12/11/03
Posts: 31
Location:Asheville, North Carolina
I've been trying to remove stories that have been archived from the site feed by tinkering with lib-syndication.php
Am I correct that it should be done somewhere in the function SYND_feedUpdateCheckAll?
This is my latest attempt but it doesn't work:
$tresult = DB_query( "SELECT tid FROM {$_TABLES['topics']}"
. COM_getPermSQL( 'WHERE', 1 ));
$tnumrows = DB_numRows( $tresult );
$topiclist = array();
for( $i = 0; $i < $tnumrows; $i++ )
{
$T = DB_fetchArray( $tresult );
//Modified to exclude archive from site feed
$archiveexclude = "archive";
$compareresult = strncmp($T['tid'],$archiveexclude);
if($compareresult != 0) {
$topiclist[] = $T['tid'];
}
//End modification
}
Is it my novice coding or am I looking in the wrong place?
Any help would be appreciated. Thanks, Matthew
Am I correct that it should be done somewhere in the function SYND_feedUpdateCheckAll?
This is my latest attempt but it doesn't work:
Text Formatted Code
// get list of topics that anonymous users have access to$tresult = DB_query( "SELECT tid FROM {$_TABLES['topics']}"
. COM_getPermSQL( 'WHERE', 1 ));
$tnumrows = DB_numRows( $tresult );
$topiclist = array();
for( $i = 0; $i < $tnumrows; $i++ )
{
$T = DB_fetchArray( $tresult );
//Modified to exclude archive from site feed
$archiveexclude = "archive";
$compareresult = strncmp($T['tid'],$archiveexclude);
if($compareresult != 0) {
$topiclist[] = $T['tid'];
}
//End modification
}
Is it my novice coding or am I looking in the wrong place?
Any help would be appreciated. Thanks, Matthew
21
13
Quote
Status: offline
Dirk
Site Admin
Admin
Registered: 01/12/02
Posts: 13073
Location:Stuttgart, Germany
I would try and roll that into the SQL query - let MySQL do the work for you. Something like
Completely untested, but that should only return the topics where the archive_flag is not set.
bye, Dirk
Text Formatted Code
$tresult = DB_query( "SELECT tid FROM {$_TABLES['topics']} WHERE archive_flag = 0" . COM_getPermSQL( 'AND', 1 ));Completely untested, but that should only return the topics where the archive_flag is not set.
bye, Dirk
16
15
Quote
Status: offline
matthewcox
Forum User
Junior
Registered: 12/11/03
Posts: 31
Location:Asheville, North Carolina
Thanks Dirk!
I forgot to mention that's where I started but I couldn't get my sql statement to work thinking that I didn't understand the interaction between that line of code and the function COM_getPermSQL.
As it turns out, I was testing in the wrong place. I was working with the function SYND_feedUpdateCheckAll when I should have been working with SYND_getFeedContentAll. Your snippet worked perfectly once I figured out where to put it
I'm assuming I should apply the same code to both functions as well right?
This works great as a feed that I bring rite back into the site to make a clean "Recent Articles" block.
See it in action along with the facelift I finally gave my site http://matthewcox.org and let me know what you think.
Thanks again, Matthew
I forgot to mention that's where I started but I couldn't get my sql statement to work thinking that I didn't understand the interaction between that line of code and the function COM_getPermSQL.
As it turns out, I was testing in the wrong place. I was working with the function SYND_feedUpdateCheckAll when I should have been working with SYND_getFeedContentAll. Your snippet worked perfectly once I figured out where to put it
I'm assuming I should apply the same code to both functions as well right?
This works great as a feed that I bring rite back into the site to make a clean "Recent Articles" block.
See it in action along with the facelift I finally gave my site http://matthewcox.org and let me know what you think.
Thanks again, Matthew
14
10
Quote
All times are EST. The time is now 02:24 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