i was menually installed the topic digest file, can anyone tell me what's wrong with the following code?
cos after i added the following code in messageindex.php , the forum said there's some coding error in line 58.
" Parse error: parse error, unexpected T_ELSE in /home/mywalker/public_html/forum/Sources/MessageIndex.php on line 58"
Make sure the starting place makes sense and construct the page index.if (isset($_REQUEST['sort']))
$context['page_index'] = constructPageIndex($scripturl . '?' . (empty($_REQUEST['viewchest']) ? '' : 'viewchest=1;') . 'board=' . $board . '.%d;sort=' . $_REQUEST['sort'] . (isset($_REQUEST['desc']) ? ';desc' : ''), $_REQUEST['start'], $board_info['num_topics'], $maxindex);
else
$context['page_index'] = constructPageIndex($scripturl . '?' . (empty($_REQUEST['viewchest']) ? '' : 'viewchest=1;') . 'board=' . $board . '.%d', $_REQUEST['start'], $board_info['num_topics'], $maxindex, true);
$context['start'] = &$_REQUEST['start'];
thanks!
the obvious thing first:
// Make sure the starting place makes sense and construct the page index.
if (isset($_REQUEST['sort']))
$context['page_index'] = constructPageIndex($scripturl . '?' . (empty($_REQUEST['viewchest']) ? '' : 'viewchest=1;') . 'board=' . $board . '.%d;sort=' . $_REQUEST['sort'] . (isset($_REQUEST['desc']) ? ';desc' : ''), $_REQUEST['start'], $board_info['num_topics'], $maxindex);
else
$context['page_index'] = constructPageIndex($scripturl . '?' . (empty($_REQUEST['viewchest']) ? '' : 'viewchest=1;') . 'board=' . $board . '.%d', $_REQUEST['start'], $board_info['num_topics'], $maxindex, true);
$context['start'] = &$_REQUEST['start'];
When adding code, you should know what you're doing ;)
Edit: damn, can't type this evening ..
hello, thanks for your kind reply.
i dont know about coding actually, i manually installed it bcos it said the messengeinex.php failed when i was trying installed through the package manager. so.... i have to manually add the coding....
well, after i replaced the coding you provide.... another error show:
Unknown column 't.chested' in 'field list'
File: /home/mywalker/public_html/forum/Sources/MessageIndex.php
Line: 470
and the code is:
" . ( empty($_REQUEST['viewchest']) || empty($modSettings['enableChest']) ? '' : 'AND (t.chested = 1 OR t.isSticky > 0)' ) . "
ORDER BY " . ($pre_query ? "FIND_IN_SET(t.ID_TOPIC, '" . implode(',', $topic_ids) . "')" : (!empty($modSettings['enableStickyTopics']) ? 'isSticky' . ($fake_ascending ? '' : ' DESC') . ', ' : '') . $_REQUEST['sort'] . ($ascending ? '' : ' DESC')) . "
LIMIT " . ($pre_query ? '' : "$start, ") . "$maxindex", __FILE__, __LINE__);
can u see anything wrong with it???
thanks x 1000000
Kel
Hello, forgot to say this earlier ^^
I can't see anything wrong with the code, but on the other side, i don't know much about mysql queries.
Does this mod require a modification to the Database? If yes, you should do it. The error should disappear then.
Edit:
As i saw in this (http://www.simplemachines.org/community/index.php?topic=57344.0) thread, it needs a database modification:
ALTER IGNORE TABLE smf_topics ADD `chested` TINYINT( 2 ) UNSIGNED DEFAULT '0' NOT NULL AFTER `isSticky`
You need to execute this mysql command in something like phpmyadmin.
QuoteYou need to execute this mysql command in something like phpmyadmin.
hi, do u know how to execute this??
thanks...
below are the code i followed and edit:
<file name="$sourcedir/MessageIndex.php">
<operation>
<search position="replace"><![CDATA[
if (isset($_REQUEST['sort']))
$context['page_index'] = constructPageIndex($scripturl . '?board=' . $board . '.%d;sort=' . $_REQUEST['sort'] . (isset($_REQUEST['desc']) ? ';desc' : ''), $_REQUEST['start'], $board_info['num_topics'], $maxindex, true);
else
$context['page_index'] = constructPageIndex($scripturl . '?board=' . $board . '.%d', $_REQUEST['start'], $board_info['num_topics'], $maxindex, true);
]]></search>
<add><![CDATA[
if (isset($_REQUEST['sort']))
$context['page_index'] = constructPageIndex($scripturl . '?' . (empty($_REQUEST['viewchest']) ? '' : 'viewchest=1;') . 'board=' . $board . '.%d;sort=' . $_REQUEST['sort'] . (isset($_REQUEST['desc']) ? ';desc' : ''), $_REQUEST['start'], $board_info['num_topics'], $maxindex);
else
$context['page_index'] = constructPageIndex($scripturl . '?' . (empty($_REQUEST['viewchest']) ? '' : 'viewchest=1;') . 'board=' . $board . '.%d', $_REQUEST['start'], $board_info['num_topics'], $maxindex, true);
]]></add>
</operation>
<operation>
<search position="before"><![CDATA[
$context['linktree'][count($context['linktree']) - 1]['extra_after'] = ' (' . (count($context['link_moderators']) == 1 ? $txt[298] : $txt[299]) . ': ' . implode(', ', $context['link_moderators']) . ')';
}
]]></search>
<add><![CDATA[ if (!empty($_REQUEST['viewchest']) && !empty($modSettings['enableChest']))
$context['linktree'][] = array(
'url' => $scripturl . '?board=' . $board . '.0;viewchest=1',
'name' => $txt['post_chest']
);
]]></add>
</operation>
<operation>
<search position="before"><![CDATA[
t.ID_TOPIC, t.numReplies, t.locked, t.numViews, t.isSticky, t.ID_POLL,
]]></search>
<add><![CDATA[ t.chested,
]]></add>
</operation>
<operation>
<search position="before"><![CDATA[
AND mf.ID_MSG = t.ID_FIRST_MSG
]]></search>
<add><![CDATA[ " . ( empty($_REQUEST['viewchest']) || empty($modSettings['enableChest']) ? '' : 'AND (t.chested = 1 OR t.isSticky > 0)' ) . "
]]></add>
</operation>
<operation>
<search position="before"><![CDATA[
'is_sticky' => !empty($modSettings['enableStickyTopics']) && !empty($row['isSticky']),
]]></search>
<add><![CDATA[ 'is_chested' => !empty($row['chested']),
]]></add>
</operation>
</file>
and i got the following error after i edited it:
Unknown column 't.chested' in 'field list'
File: /home/mywalker/public_html/forum/Sources/MessageIndex.php
Line: 470
Quote from: ukwalker on July 03, 2006, 08:03:10 PM
QuoteYou need to execute this mysql command in something like phpmyadmin.
hi, do u know how to execute this??
thanks...
You need to run it via phpmyadmin (on the left frame is a button with the text "SQL" on it, thats the SQL-Query window, where you can execute this mysql query) or make a little script that runs it.
If your host doesnt have phpmyadmin, you can download it from www.phpmyadmin.net and install it on your webspace.