News:

SMF 2.1.4 has been released! Take it for a spin! Read more.

Main Menu

Links to recent threads in list form on 'static' page.

Started by destalk, October 18, 2006, 02:22:07 PM

Previous topic - Next topic

Rudolf

The attached file is corrupted or something, the text is all messed up.
Replace with an original one, and add the function again.
I will update all my mods in the next few weeks. Thanks for your patience.

SVG-Collapse (you need an SVG compliant browser)

destalk

#21
Thanks for trying Rudolf.

I've downloaded a brand new SSI.php file but I get the same error message.

I suppose it must be something with my server or installation. Strange though, because all the other inlcudes work fine.

I have attached the new file, but I appreciate that you have spent a lot of time on this, so please don't feel obliged to look at it. I really do appreciate the time you've spent to help me.

destalk

#22
Ah, I fixed it. It was clashing with something else I did a while ago... (it's a long story ;) ). Sorry for being such a dunderhead.

Rudolf, you are a star. I have been trying to get this working for years.

Thank you very very much for your time. I really appreciate this.

destalk

#23
Eeeek. After a day or working well, the 'static' page freaked out and threw all sorts of database errors.

<EDIT> I removed the specific errors because all fixed now.</EDIT>

destalk

OK repaired the SMF mySQL database and also ran the SMF maintenance repairs and the problem is fixed. Phew!

I'm going to have to monitor this, I suppose.

destalk

Ah, OK. I have worked out when this error occurs.

If the 'static' page is viewed by a guest, this all works perfectly.

But when a member is logged in and they view the 'static' page, they get a whole series of errors, including the following;

Warning: template_main_above(headersimple.php) [function.template-main-above]: failed to open stream: No such file or directory in /home/user/public_html/forum/Sources/Load.php(1607) : eval()'d code on line 173


"headersimple.php" is the header page for my forum, BTW.

Warning: template_main_above() [function.include]: Failed opening 'headersimple.php' for inclusion (include_path='.:/usr/lib/php:/usr/local/lib/php') in /home/user/public_html/forum/Sources/Load.php(1607) : eval()'d code on line 173


Database Error
Please try again. If you come back to this error screen, report the error to an administrator.


Warning: template_main_below(footer.php) [function.template-main-below]: failed to open stream: No such file or directory in /home/user/public_html/forum/Sources/Load.php(1607) : eval()'d code on line 293


"footer.php" is my forum footer file.

Any thoughts on why this might tbe happening?

Rudolf

It's really hard to tell without seeing the 'static' page.
Try to add right after including the SSI.php file
$context['template_layers'] = array();
I will update all my mods in the next few weeks. Thanks for your patience.

SVG-Collapse (you need an SVG compliant browser)

destalk

#27
The error happens on a bank 'static' page with<?php require("/home/user/public_html/forum/SSI.php");  ob_start('ob_sessrewrite'); ?> on the first line and <?php

$array 
ssi_latestTopics(17, array(), 'array');
foreach (
$array as $topic)
echo 
$topic['link'], '<br />';
?>
in the body.

I added your code into the first line, so that it read like this <?php require("/home/user/public_html/forum/SSI.php");  ob_start('ob_sessrewrite'); $context['template_layers'] = array(); ?>

But it then returned the following error;

Database Error
Unknown column 'lt.logTime' in 'field list'
File: /home/user/public_html/forumuser/SSI.php
Line: 1554

Rudolf

There are two versions of the function for the two versions for SMF (1.0.8 vs RC2/3). Are you sure you're using the right version for your forum?
I will update all my mods in the next few weeks. Thanks for your patience.

SVG-Collapse (you need an SVG compliant browser)

destalk

#29
I'm pretty sure I copied the first one you posted (I'm using RC2).

But it won't be the first time I've stuffed up.  ::)

This is the code I used. Is it wrong?

// Latest topic list:   [board] Subject by Poster Date
function ssi_latestTopics($num_recent = 8, $exclude_boards = array(), $output_method = 'echo')
{
global $context, $settings, $scripturl, $txt, $db_prefix, $ID_MEMBER, $user_info, $modSettings;

// Find all the posts in distinct topics.  Newer ones will have higher IDs.
$request = db_query("
SELECT
m.posterTime, ms.subject, m.ID_TOPIC, m.ID_MEMBER, m.ID_MSG, b.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}topics AS t, {$db_prefix}boards AS b, {$db_prefix}messages AS ms)
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 = t.ID_TOPIC AND lt.ID_MEMBER = $ID_MEMBER)
LEFT JOIN {$db_prefix}log_mark_read AS lmr ON (lmr.ID_BOARD = b.ID_BOARD AND lmr.ID_MEMBER = $ID_MEMBER)" : '') . "
WHERE m.ID_MSG >= " . ($modSettings['maxMsgID'] - 8 * $num_recent) . "
AND t.ID_FIRST_MSG = m.ID_MSG
AND b.ID_BOARD = t.ID_BOARD" . (empty($exclude_boards) ? '' : "
AND b.ID_BOARD NOT IN (" . implode(', ', $exclude_boards) . ")") . "
AND $user_info[query_see_board]
AND ms.ID_MSG = t.ID_FIRST_MSG
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'])) > 25 ? htmlspecialchars(substr(un_htmlspecialchars($row['subject']), 0, 22) . '...') : $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'] . '.0">' . $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>';
}

Advertisement: