SimplePortal
Support => English Support => Topic started by: lilmina on December 10, 2008, 07:23:36 PM
-
how can i set the order of the articles so their order wont based on posting time but based on the order that myself want?
-
You cannot set that, at least for now. We will consider this for the future versions.
-
hello,
I need this function too,
Does a new version of SP have it? When will you make it?
Thank you!
-
hello,
I need this function too,
Does a new version of SP have it? When will you make it?
Thank you!
Hello,
I can show you a way to hardcode this functionality in if you would like.
-
Yes, I would like )
-
Yes, I would like )
http://simpleportal.net/index.php?topic=14160.msg70539#msg70539
-
Thank you,
but what I must hardcoding to automatic ording by Creation_time of article?
I think, now is ordering by First_message_ID
$request = $smcFunc['db_query']('','
SELECT
m.id_topic, m.subject, m.poster_name, c.picture, c.name,
mem.id_member, mem.real_name, mem.avatar,
at.id_attach, at.attachment_type, at.filename
FROM {db_prefix}sp_articles AS a
INNER JOIN {db_prefix}sp_categories AS c ON (c.id_category = a.id_category)
INNER JOIN {db_prefix}messages AS m ON (m.id_msg = a.id_message)
INNER JOIN {db_prefix}boards AS b ON (b.id_board = m.id_board)
LEFT JOIN {db_prefix}members AS mem ON (mem.id_member = m.id_member)
LEFT JOIN {db_prefix}attachments AS at ON (at.id_member = mem.id_member)
WHERE {query_see_board}
AND a.approved = {int:approved}' . (!empty($category) ? '
AND a.id_category = {int:category}' : '') . '
ORDER BY {raw:type}
.....
may be I need change last parameter - ORDER BY?
-
Please follow the link Sayaka Maizono kindly provided. Thank you!
-
Ninja,
I followed, Sticky Articles code has hard defined order of article,
I need order by Time_Of_Article_Created,
as you can see at my site http://www.sportgen.ru/forum/
I have incorrect order,
I dont ready hardcoding every time new article released
Thank you
-
That should be a standard SimplePortal feature actually... Display type "Latest" does exactly that, unless I am misunderstanding you (in which case sorry).
-
Ninja,
I followed, Sticky Articles code has hard defined order of article,
I need order by Time_Of_Article_Created,
as you can see at my site http://www.sportgen.ru/forum/
I have incorrect order,
I dont ready hardcoding every time new article released
Thank you
If you just want to sort the articles on creation, you can do this.
Open /Sources/PortalBlocks.php
Find:
$request = $smcFunc['db_query']('','
SELECT
m.id_topic, m.subject, m.poster_name, m.id_board, c.picture, c.name,
mem.id_member, mem.real_name, mem.avatar,
at.id_attach, at.attachment_type, at.filename
FROM {db_prefix}sp_articles AS a
INNER JOIN {db_prefix}sp_categories AS c ON (c.id_category = a.id_category)
INNER JOIN {db_prefix}messages AS m ON (m.id_msg = a.id_message)
INNER JOIN {db_prefix}boards AS b ON (b.id_board = m.id_board)
LEFT JOIN {db_prefix}members AS mem ON (mem.id_member = m.id_member)
LEFT JOIN {db_prefix}attachments AS at ON (at.id_member = mem.id_member)
WHERE {query_see_board}
AND a.approved = {int:approved}' . (!empty($category) ? '
AND a.id_category = {int:category}' : '') . '
ORDER BY {raw:type}
LIMIT {int:limit}',
array(
'approved' => 1,
'category' => $category,
'type' => $type ? 'RAND()' : 'm.poster_time DESC',
'limit' => $limit,
)
);
Replace with:
$request = $smcFunc['db_query']('','
SELECT
m.id_topic, m.subject, m.poster_name, m.id_board, c.picture, c.name,
mem.id_member, mem.real_name, mem.avatar,
at.id_attach, at.attachment_type, at.filename
FROM {db_prefix}sp_articles AS a
INNER JOIN {db_prefix}sp_categories AS c ON (c.id_category = a.id_category)
INNER JOIN {db_prefix}messages AS m ON (m.id_msg = a.id_message)
INNER JOIN {db_prefix}boards AS b ON (b.id_board = m.id_board)
LEFT JOIN {db_prefix}members AS mem ON (mem.id_member = m.id_member)
LEFT JOIN {db_prefix}attachments AS at ON (at.id_member = mem.id_member)
WHERE {query_see_board}
AND a.approved = {int:approved}' . (!empty($category) ? '
AND a.id_category = {int:category}' : '') . '
ORDER BY {raw:type}
LIMIT {int:limit}',
array(
'approved' => 1,
'category' => $category,
'type' => $type ? 'RAND()' : 'm.poster_time ASC',
'limit' => $limit,
)
);