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

Recent

Welcome to TinyPortal. Please login or sign up.

April 20, 2024, 07:14:38 AM

Login with username, password and session length
Members
  • Total Members: 3,885
  • Latest: Growner
Stats
  • Total Posts: 195,165
  • Total Topics: 21,219
  • Online today: 118
  • Online ever: 3,540 (September 03, 2022, 01:38:54 AM)
Users Online
  • Users: 1
  • Guests: 114
  • Total: 115
  • lurkalot

Few blocks from TP causing my site to eat resources.

Started by Ricky., December 14, 2007, 07:26:52 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Zetan

QuoteWarning - while you were typing 2 new replies have been posted. You may wish to review your post.

pipped  :o

try this.. it's a custom snippet I made for myself.. you can see it on my home page.. the Review blocks.

I'm not a coder and I made this purely for myself.. if a coder can addapt it for all boards, thats fine.. but it's set for specific boards as is.



/******************************************************************************
* Reviews SSI                                                                 *
*******************************************************************************
* For TinyPortal                                                              *
*                                                                             *
* =========================================================================== *
* Software Version:           1.0                                             *
*                                                                             *
*                                                                             *
*                                                                             *
* Software by:                Zetan aka LAB DESIGN                            *
*                                                                             *
*                                                                             *
*          My First Code :D                                                   *
*             Damn being a n000b :P                                           *
*                                                                             *
*                                                                             *
*                                                                             *
* Support, News, Updates at:  This snippet is as. No updates guaranteed       *
*******************************************************************************
* This program is free software; you may redistribute it and/or modify it     *
* under the terms of the provided license as published by Lewis Media.        *
*                                                                             *
* This program is distributed in the hope that it is and will be useful,      *
* but WITHOUT ANY WARRANTIES; without even any implied warranty of            *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.                        *
*                                                                             *
* See the "license.txt" file for details of the Simple Machines license.      *
* The latest version can always be found at http://www.simplemachines.org.    *
******************************************************************************/

// Review Type

{

echo '
<div style="padding: 5px;" class="mediumtext"><p style="margin: 0pt; padding: 0pt 0pt 0.5ex;"><img src="URL.com/review_ico.gif" align="absmiddle"></img>   
<a href="URL.com/board,66.0.html"  Title="Recent Member Gig Reviews from the Gig Reviews board.">Gig Reviews</a><br><hr width="100%" /></div>';


}       

// Fetch Board, Number of Topics Displayed. Subject, Time & Date and Topic Starter

$array = ssi_boardNews(66.0, 8, null, null, 'array');
foreach ($array as $r)   

{
echo '
<div style="padding: 0px;" class="smalltext"><p style="margin: 0pt; padding: 0pt 0pt 0.5ex;">
<a href="', $r['href'], '">', $r['subject'], '</a><br>',  '['.$r['time'].']', '<br>by <b>', $r['poster']['link'], '</b></p></div>';

if (!$r['is_last'])
echo '
<hr width="100%" />';
}

     
// Submit Review

{


echo '
<hr>
<div style="padding: 5px;" class="mediumtext"><p style="margin: 0pt; padding: 0pt 0pt 0.5ex;"><img src="http://URL.com/review_ico2.gif" align="absmiddle"></img>   
<a href="URL.com/index.php?action=post;board=66.0" Title="You must be a registered member to submit a review.">Submit a Review</a></div>';
}



It won't work straight away as I've removed my site URL details.. You'll need to change boards and other detail.

What it does is pull Topic, Author, Time and Date only.. No new posts, just Topic headings from a specific board. It can be changed to include all boards, but I'm posting it as is.

Ricky.

I guess, ssi_boardnews function can take only one board.. and I want topics to be displayed from whole FORUM.

Ricky.

Thnx bloc but I need "Latest Topics" and your code is deplaying recent topics.. ie. if someone replies to a old topic then it would come first. .. but I need latest topics only!

IchBin

What you're asking for is to ignore old topics? Thats a bit hard to do. By what criteria would you do this? How would you ignore old topics?  SMF displays the latest topic that is posted in. So how would you decide to display yours?

Smoky


Ricky.

Why we are having confusion over here ?

Let me explain again
....
When I use TP's built in Recent topic feature then it actually shows most recent replies to any of the post..

When I use RecentTopics feature of SSI then it actually shows  recent Topics started with most recent replies.

What Bloc posted here was showing recent replies but not the Latest Topics..

And what I want is simply list of "Latest Topics" started  on my board irrespective replies etc. Also it must lead to topic but not the latest reply on that topic.

You know I am digging many posts here and on smf forum just to find solution .. and now I certainly need to learn php properly.
Here is one such thread : its all about SSI http://www.simplemachines.org/community/index.php?topic=14906.0

Well, I understand that its confusing..

You go here and try to tell me what exactly the  is difference there in recenttopics and recentposts function ... bcz both are displaying almost same stuff........
http://www.simplemachines.org/community/ssi_examples.php


bloc

To clear things up..recent topics displays the title of the topic a recent post has been made in, with a "new" indicator to mark it, while recent posts displays the actual post(or subject of course). So the distinction is quite clear.

What you seek though, seems to be "latest created topics", and not "latest posts"? Regardless if it has new replies or not?

Ricky.

Yes..
I thought calling "Latest Topic" is enough .. but as Bloc made it clear. ..
I am referring to "Latest Topic Created" (irrespective replies to it) :)


jacortina

"Newest Topics" might be more appropriate:

global $scripturl, $settings, $db_prefix, $user_info, $modSettings;

$bullet = '<img src="'.$settings['images_url'].'/TPdivider.gif" alt="" border="0" style="margin:0 4px 0 0;" />';

$list_count = 5;

$request = db_query("
SELECT
ms.subject AS firstSubject, ms.posterTime AS firstPosterTime, ms.ID_TOPIC, t.ID_BOARD, b.name AS bname
FROM ({$db_prefix}messages AS ms, {$db_prefix}topics AS t, {$db_prefix}boards AS b)
WHERE   t.ID_TOPIC = ms.ID_TOPIC
AND b.ID_BOARD = t.ID_BOARD " . (!empty($modSettings['recycle_enable']) && $modSettings['recycle_board'] > 0 ? " AND b.ID_BOARD != $modSettings[recycle_board]" : '') . "
AND ms.ID_MSG = t.ID_FIRST_MSG
AND " . $user_info['query_see_board'] . "
ORDER BY t.ID_FIRST_MSG DESC LIMIT " . $list_count, __FILE__, __LINE__);

echo '
<table border="0">';

while ($row = mysql_fetch_assoc($request))
echo ' <tr>
<td valign="middle">', $bullet, '<a href="',  $scripturl . '?topic=' . $row['ID_TOPIC'] . '.0;topicseen"><b>', $row['firstSubject'], '</b></a></td>
</tr>';

echo '
</table border>';

bloc

Might be nice to add a time-limit on that. :) Especially if you add a relative high number. Otherwise you can still get old topics, just to fill up the counter.