Re: User selectable post order [message #24527 is a reply to message #24371] |
Sun, 01 May 2005 16:45 |
jonmoss
Messages: 93 Registered: September 2004 Location: Lansing, KS
Karma:
|
Member |
|
|
Ilia wrote on Mon, 25 April 2005 17:55 | The source code files cannot be edited via template editor, as the name suggests it is intended for templates ONLY.
Source files should be edited manually, I suspect you simply didn't edit the file correctly resulting in a parser error or a broken SQL query.
|
I was logged in as root and edited the file changing ASC to DESC in the query. I saved it and rebuilt the theme. When I logged in, nothing was displayed at all when I went to flat view.
Should I not edit as root?
Here's the code/query I was editing:
Quote: | /* This is an optimization intended for topics with many messages */
if ($frm->replies > 250) {
q("CREATE TEMPORARY TABLE {SQL_TABLE_PREFIX}_mtmp_".__request_timestamp__." AS SELECT id FROM {SQL_TABLE_PREFIX}msg
WHERE thread_id=".$_GET['th']." AND apr=1 ORDER BY id ASC LIMIT " . qry_limit($count, $_GET['start']));
}
$result = $query_type('SELECT
m.*,
t.thread_opt, t.root_msg_id, t.last_post_id, t.forum_id,
f.message_threshold,
u.id AS user_id, u.alias AS login, u.avatar_loc, u.email, u.posted_msg_count, u.join_date, u.location,
u.sig, u.custom_status, u.icq, u.jabber, u.affero, u.aim, u.msnm, u.yahoo, u.users_opt, u.last_visit AS time_sec,
l.name AS level_name, l.level_opt, l.img AS level_img,
p.max_votes, p.expiry_date, p.creation_date, p.name AS poll_name, p.total_votes,
'.(_uid ? ' pot.id AS cant_vote ' : ' 1 AS cant_vote ').'
FROM '.($frm->replies > 250 ? '{SQL_TABLE_PREFIX}_mtmp_'.__request_timestamp__.' mt INNER JOIN {SQL_TABLE_PREFIX}msg m ON m.id=mt.id' : ' {SQL_TABLE_PREFIX}msg m').'
INNER JOIN {SQL_TABLE_PREFIX}thread t ON m.thread_id=t.id
INNER JOIN {SQL_TABLE_PREFIX}forum f ON t.forum_id=f.id
LEFT JOIN {SQL_TABLE_PREFIX}users u ON m.poster_id=u.id
LEFT JOIN {SQL_TABLE_PREFIX}level l ON u.level_id=l.id
LEFT JOIN {SQL_TABLE_PREFIX}poll p ON m.poll_id=p.id'.
(_uid ? ' LEFT JOIN {SQL_TABLE_PREFIX}poll_opt_track pot ON pot.poll_id=p.id AND pot.user_id='._uid : ' ').
($frm->replies > 250 ? ' ORDER BY m.id ASC' : " WHERE m.thread_id=".$_GET['th']." AND m.apr=1 ORDER BY m.id ASC LIMIT " . qry_limit($count, $_GET['start'])));
|
My plan was to change the ASC to DESC in the ORDER BY clause. Have I got the right query?
Thanks and have a great day!
Jon Moss
[Updated on: Sun, 01 May 2005 17:01] Report message to a moderator
|
|
|