News:

Bored?  Looking to kill some time?  Want to chat with other SMF users?  Join us in IRC chat or Discord

Main Menu

RecentPosts - Count of posts shown if some boards excluded

Started by bryan_49ers, March 21, 2006, 01:34:57 AM

Previous topic - Next topic

kegobeer

What are your settings for sessions and local storage of cookies (Admin -> Features and Options)?  Also, if you create a php script (not shtml), do you still have this issue?
"The truth of the matter is that you always know the right thing to do. The hard part is doing it." - Norman Schwarzkopf
Posting and you (Click "WATCH THIS MOVIE")

JayBachatero

I see 5 recent topics.

Abraham a Falcon in 3-way deal- Today at 02:00:43 PM
Peterson is a Seahawk- March 20, 2006, 06:56:59 PM
Rashaun Woods Last Chance- March 20, 2006, 07:24:01 AM
Peter Boulware released- March 17, 2006, 04:51:11 AM
Aaron Shea and Jeb Putzier- March 16, 2006, 06:26:05 AM
Follow me on Twitter

"HELP!!! I've fallen and I can't get up"
This moment has been brought to you by LifeAlert

bryan_49ers

I have three different scripts running there.. the one I'm talking about has a "1" next to it

it looks like
Front Office / Coaching

1YOU fill in the captio... -Today at 10:53:53 AM

http://49ersparadise.com/forum/feed2b.php has the same issue

cookie length is 60 mins
local storage is on (what happens if I turn it off?) what do I miss out on?

JayBachatero

Follow me on Twitter

"HELP!!! I've fallen and I can't get up"
This moment has been brought to you by LifeAlert

kegobeer

SSI doesn't work well if you use local storage of cookies.  Turn it off.
"The truth of the matter is that you always know the right thing to do. The hard part is doing it." - Norman Schwarzkopf
Posting and you (Click "WATCH THIS MOVIE")

bryan_49ers

what do you mean by everything I have in feed2b.php?

what is the value of local stoarge of cookies ... what does it do.  Before I turn it off, I want to make sure that the benefit out weighs the cost.

JayBachatero

It stores the cookies in your PC instead of the database.  Storing it on the DB give you the ability to take with you the contents of the cookie from PC to PC.

I mean to copy and paste everything in that file. feed2b.php.
Follow me on Twitter

"HELP!!! I've fallen and I can't get up"
This moment has been brought to you by LifeAlert

bryan_49ers

OK I turned it off

this is feed2b.php

<?php
include_once('ssi_newfeed.php');
$posts ssi_recentTopics(5,array(1,2,3,4,5,6,8,9), $output_method 'array');



foreach (
$posts as $post)

{

$counter $counter+1;
echo 
$counter;
  echo 
'<a href="'$post['href'], '">',$post['short_subject'],'</a> -'$post['time'], '<BR>';

}
?>



this is the ssi file that is included in it

<?php
include_once('SSI.php');
// Recent post list:   [board] Subject by Poster Date
function ssi_recentPosts($num_recent 40$exclude_boards = array(), $output_method 'echo')
{
global $context$settings$scripturl$txt$db_prefix$ID_MEMBER$user_info$modSettings;

// Find all the posts.  Newer ones will have higher IDs.
$request db_query("
SELECT
m.posterTime, m.subject, m.ID_TOPIC, m.ID_MEMBER, m.ID_MSG, m.ID_BOARD, b.name AS bName,
IFNULL(mem.realName, m.posterName) AS posterName, " 
. ($user_info['is_guest'] ? '1 AS isRead, 0 AS logTime' '
IFNULL(lt.logTime, IFNULL(lmr.logTime, 0)) >= GREATEST(m.posterTime, m.modifiedTime) AS isRead,
IFNULL(lt.logTime, IFNULL(lmr.logTime, 0)) AS logTime'
) . "
FROM (
{$db_prefix}messages AS m, {$db_prefix}boards AS b)
LEFT JOIN 
{$db_prefix}members AS mem ON (mem.ID_MEMBER = m.ID_MEMBER)" . (!$user_info['is_guest'] ? "
LEFT JOIN 
{$db_prefix}log_topics AS lt ON (lt.ID_TOPIC = m.ID_TOPIC AND lt.ID_MEMBER = $ID_MEMBER)
LEFT JOIN 
{$db_prefix}log_mark_read AS lmr ON (lmr.ID_BOARD = m.ID_BOARD AND lmr.ID_MEMBER = $ID_MEMBER)" '') . "
WHERE m.ID_MSG >= " 
. ($modSettings['maxMsgID'] - $num_recent) . "
AND b.ID_BOARD = m.ID_BOARD" 
. (empty($exclude_boards) ? '' "
AND b.ID_BOARD NOT IN (" 
implode(', '$exclude_boards) . ")") . "
AND 
$user_info[query_see_board]
ORDER BY m.ID_MSG DESC
LIMIT 
$num_recent"__FILE____LINE__);
$posts = array();
while ($row mysql_fetch_assoc($request))
{
// Censor the subject.
censorText($row['subject']);

// Build the array.
$posts[] = array(
'board' => array(
'id' => $row['ID_BOARD'],
'name' => $row['bName'],
'href' => $scripturl '?board=' $row['ID_BOARD'] . '.0',
'link' => '<a href="' $scripturl '?board=' $row['ID_BOARD'] . '.0">' $row['bName'] . '</a>'
),
'topic' => $row['ID_TOPIC'],
'poster' => array(
'id' => $row['ID_MEMBER'],
'name' => $row['posterName'],
'href' => empty($row['ID_MEMBER']) ? '' $scripturl '?action=profile;u=' $row['ID_MEMBER'],
'link' => empty($row['ID_MEMBER']) ? $row['posterName'] : '<a href="' $scripturl '?action=profile;u=' $row['ID_MEMBER'] . '">' $row['posterName'] . '</a>'
),
'subject' => $row['subject'],
'short_subject' => strlen(un_htmlspecialchars($row['subject'])) > 50 htmlspecialchars(substr(un_htmlspecialchars($row['subject']), 045) . '...') : $row['subject'],
'time' => timeformat($row['posterTime']),
'timestamp' => $row['posterTime'],
'href' => $scripturl '?topic=' $row['ID_TOPIC'] . '.msg' $row['ID_MSG'] . ';topicseen#msg' $row['ID_MSG'],
'link' => '<a href="' $scripturl '?topic=' $row['ID_TOPIC'] . '.msg' $row['ID_MSG'] . '#msg' $row['ID_MSG'] . '">' $row['subject'] . '</a>',
'new' => !empty($row['isRead']),
'newtime' => $row['logTime']
);
}
mysql_free_result($request);

// Just return it.
if ($output_method != 'echo' || empty($posts))
return $posts;

echo '
<table border="0" class="ssi_table">'
;
foreach ($posts as $post)
echo '
<tr>
<td align="right" valign="top" nowrap="nowrap">
['
$post['board']['link'], ']
</td>
<td valign="top">
<a href="'
$post['href'], '">'$post['subject'], '</a>
'
$txt[525], ' '$post['poster']['link'], '
'
$post['new'] ? '' '<a href="' $scripturl '?topic=' $post['topic'] . '.from' $post['newtime'] . ';topicseen#new"><img src="' $settings['images_url'] . '/' $context['user']['language'] . '/new.gif" alt="' $txt[302] . '" border="0" /></a>''
</td>
<td align="right" nowrap="nowrap">
'
$post['time'], '
</td>
</tr>'
;
echo '
</table>'
;
}
?>

kegobeer

Try this instead:


<?php

require ('SSI.php');

$posts ssi_recentTopics(5, array(1,2,3,4,5,6,8,9), 'array');

foreach (
$posts as $post)
{
  
$counter $counter+1;
  echo 
$counter;
  echo 
' <a href="'$post['href'], '">'$post['short_subject'], '</a> -'$post['time'], '<br>';
}
?>


I don't understand why you included SSI.php and then immediately redeclared function ssi_recentPosts.  Can you explain why you did that?
"The truth of the matter is that you always know the right thing to do. The hard part is doing it." - Norman Schwarzkopf
Posting and you (Click "WATCH THIS MOVIE")

JayBachatero

also use Scounter = 1; before the foreach statement and remove $counter = $counter+1;.  Change echo $counter; to echo $counter++;
Follow me on Twitter

"HELP!!! I've fallen and I can't get up"
This moment has been brought to you by LifeAlert

bryan_49ers

This is the current code

<?php
include_once('ssi_newfeed.php');
$posts ssi_recentTopics(5,array(1,2,3,4,5,6,8,9), $output_method 'array');

$counter 1

foreach (
$posts as $post)

{


echo 
$counter++;
  echo 
'<a href="'$post['href'], '">',$post['short_subject'],'</a> -'$post['time'], '<BR>';

}
?>



Now I don't have any being output

JayBachatero

You still including ssi_newfeed.php.  Include SSI.php and use the full path.
$counter = 1; should be $counter = 0;
Follow me on Twitter

"HELP!!! I've fallen and I can't get up"
This moment has been brought to you by LifeAlert

bryan_49ers

same result...
ssi.php is in the same folder, I shouldn't need to post the full directory name with it

<?php
include_once('SSI.php');
$posts ssi_recentTopics(5,array(1,2,3,4,5,6,8,9), $output_method 'array');

$counter 0

foreach (
$posts as $post)

{


echo 
$counter++;
  echo 
'<a href="'$post['href'], '">',$post['short_subject'],'</a> -'$post['time'], '<BR>';

}
?>


kegobeer

What didn't you understand about my post?  Do as I instructed.


<?php

require ('SSI.php');

$posts ssi_recentTopics(5, array(1,2,3,4,5,6,8,9), 'array');

foreach (
$posts as $post)
{
  
$counter $counter+1;
  echo 
$counter;
  echo 
' <a href="'$post['href'], '">'$post['short_subject'], '</a> -'$post['time'], '<br>';
}
?>

"The truth of the matter is that you always know the right thing to do. The hard part is doing it." - Norman Schwarzkopf
Posting and you (Click "WATCH THIS MOVIE")

bryan_49ers

same result with that code

The probelm is clearly in relation to the order the filter is applied. How can I either change this order, or break out of the foreach cycle after 5 turns

kegobeer

Send me a link to your forum, with an admin username and password.  Also send me the link to the code I posted.
"The truth of the matter is that you always know the right thing to do. The hard part is doing it." - Norman Schwarzkopf
Posting and you (Click "WATCH THIS MOVIE")

bryan_49ers

Kindred, did you come up with anything yesterday by any chance?


Kindred

Bryan,

Sorry... things got busy at work and I have not had a chance to do anything with this yet...
Слaва
Украинi

Please do not PM, IM or Email me with support questions.  You will get better and faster responses in the support boards.  Thank you.

"Loki is not evil, although he is certainly not a force for good. Loki is... complicated."

bryan_49ers

ok.. I'll be around for most of the day if you do get a chance...

Advertisement: