SimplePortal

Support => English Support => Topic started by: lilmina on December 10, 2008, 07:23:36 PM

Title: setting articles order ?how can i set the order of the articles so their order w
Post 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?
Title: Re: setting articles order ?how can i set the order of the articles so their order w
Post by: [SiNaN] on December 20, 2008, 07:06:40 AM
You cannot set that, at least for now. We will consider this for the future versions.
Title: Re: setting articles order ?how can i set the order of the articles so their order w
Post by: ramzesito on October 29, 2015, 06:31:58 PM
hello,
I need this function too,
Does a new version of SP have it? When will you make it?

Thank you!
Title: Re: setting articles order ?how can i set the order of the articles so their order w
Post by: ccbtimewiz on October 29, 2015, 07:17:16 PM
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.
Title: Re: setting articles order ?how can i set the order of the articles so their order w
Post by: ramzesito on October 30, 2015, 01:50:45 AM
Yes, I would like  )
Title: Re: setting articles order ?how can i set the order of the articles so their order w
Post by: ccbtimewiz on October 30, 2015, 04:13:13 PM
Yes, I would like  )

http://simpleportal.net/index.php?topic=14160.msg70539#msg70539
Title: Re: setting articles order ?how can i set the order of the articles so their order w
Post by: ramzesito on October 31, 2015, 05:27:32 AM
Thank you,
but what I must hardcoding to automatic ording by Creation_time of article?
I think, now is ordering by First_message_ID

Quote
$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?
Title: Re: setting articles order ?how can i set the order of the articles so their order w
Post by: ♦ Ninja ZX-10RR ♦ on October 31, 2015, 06:04:36 AM
Please follow the link Sayaka Maizono kindly provided. Thank you!
Title: Re: setting articles order ?how can i set the order of the articles so their order w
Post by: ramzesito on October 31, 2015, 10:49:07 AM
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
Title: Re: setting articles order ?how can i set the order of the articles so their order w
Post by: ♦ Ninja ZX-10RR ♦ on October 31, 2015, 11:13:02 AM
That should be a standard SimplePortal feature actually... Display type "Latest" does exactly that, unless I am misunderstanding you (in which case sorry).
Title: Re: setting articles order ?how can i set the order of the articles so their order w
Post by: ccbtimewiz on October 31, 2015, 05:32:27 PM
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:
Code: [Select]
$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:
Code: [Select]
$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,
)
);
SimplePortal 2.3.8 © 2008-2024, SimplePortal