TP-Docs
HTML5 Icon HTML5 Icon HTML5 Icon
TP on Social Media

Recent

Welcome to TinyPortal. Please login or sign up.

April 28, 2024, 09:11:35 PM

Login with username, password and session length
Members
  • Total Members: 3,885
  • Latest: Growner
Stats
  • Total Posts: 195,173
  • Total Topics: 21,219
  • Online today: 130
  • Online ever: 3,540 (September 03, 2022, 01:38:54 AM)
Users Online
  • Users: 1
  • Guests: 96
  • Total: 97
  • @rjen

Sort frontpage posts differently

Started by janilxx, December 07, 2007, 06:03:46 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

janilxx

I show only forum posts from some categories in frontpage.

TPortal.php has this code

// Find the posts.
$request = db_query("
SELECT
m.icon, m.subject, m.body, IFNULL(mem.realName, m.posterName) AS posterName, m.posterTime,
t.numReplies, t.ID_TOPIC, m.ID_MEMBER, m.smileysEnabled, m.ID_MSG, t.locked, t.numViews,t.numReplies
FROM ({$db_prefix}topics AS t, {$db_prefix}messages AS m)
LEFT JOIN {$db_prefix}members AS mem ON (mem.ID_MEMBER = m.ID_MEMBER)
WHERE t.ID_FIRST_MSG IN (" . implode(', ', $posts) . ")
AND m.ID_MSG = t.ID_FIRST_MSG
ORDER BY t.ID_FIRST_MSG DESC
LIMIT " . count($posts), __FILE__, __LINE__);


which I believe gets the posts from DB.


If I change order from
ORDER BY t.ID_FIRST_MSG DESC
to
t.ID_LAST_MSG
I suppose I would get topic ('s first message) on top on frontpage when someone adds new message to topic.


But I would like to get topic ('s first message) on top on frontpage when topic's first message is edited. So the order would be first by t.ID_FIRST_MSG DESC and then also by m.modifiedTime (which is 0 if message is not edited).

Would this be possible? And if yes, would someone give me code for this  :laugh:

Thanks.

bloc

Try to just add like: "ORDER BY t.ID_FIRST_MSG DESC,m.modifiedTime"

That would sort on ID_FIRST_MSG first, then modifiedTime.

cypher223

it didn't work for me

I want to show the recent posts at the frontpage. The topics that comes in Recent post block should be displayed in the frontpage.

And is there any way to show posts from more than 5 boards. I can only select 5 boards to be shown in frontpage.

bloc

Recent posts..or recent topics? I am confused lol, the recent topics block show just topics, while frontpage "forumposts" show only posts from 5 selected boards.

To show recent topics on frontpage too, just use a frontpage block with type "recent topics". As for more than 5 boards, no, not without modifying 4 files in the process.

cypher223

I mean to say that . Front page should show the recent updated topic not the topic that was started first. And in frontpage we can see only the first post of the topic but i want to show off the latest post or the last post.

for eg- I have a topic which shows the results of the premierleague so whenever i reply in this topic with the new scores, this topic should be shown in the frontpage with the latest scores.

I have solved the problem of showing the latest updated topic by changing

ORDER BY FIRST_MSG_ID DESC 
to
ORDER BY LAST_MSG_ID DESC


but i cant show the latest post of the topic in the frontpage.

cypher223

and about showing more than 5 boards.

If it is not possible to show from more than 5 boards. Is is possible to randomly select the 5 board from which the topic will be shown. Some times from sports board and somtimes from Music board.

IchBin

To choose more boards for board news on frontpage.
http://www.tinyportals.net/index.php?topic=13069.msg125356#msg125356

Did you try recentPosts for your frontpage instead of boardnews?

cypher223

Where can i choose recent post. There are options like

Only forum posts
Forum posts and articles etc...

And i have choosen only Forum post

IchBin

If you want recent posts you need to put them in a block or article. Check the block code snippets board for the code to get what you want.

cypher223

I could not find anything helpful.

When we click on the "view most recent posts on the Forum" we can see the latest post of the forum.

Can u prepare a code to place in a block which will show the same results.

The recent post page shows the complete post but i need to show only a part of the post if its long. Reply soon i am online now in my msn

pravin_threedee@hotmail.com