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

Recent

Welcome to TinyPortal. Please login or sign up.

May 14, 2024, 09:54:11 PM

Login with username, password and session length
Members
  • Total Members: 3,886
  • Latest: Grendor
Stats
  • Total Posts: 195,188
  • Total Topics: 21,220
  • Online today: 176
  • Online ever: 3,540 (September 03, 2022, 01:38:54 AM)
Users Online
  • Users: 1
  • Guests: 90
  • Total: 91
  • tino

"recent topics" in SMF style

Started by Lesmond, August 17, 2005, 12:01:38 PM

Previous topic - Next topic

0 Members and 3 Guests are viewing this topic.

pvcblue

Quote from: J.A.Cortina on November 26, 2006, 10:34:38 PM
This piece seems to put out the 'new' image for topics which AREN'T new???

                // Is this topic new? (assuming they are logged in!)
                if (!$topic['new'] && $context['user']['is_logged'])


Does changing it to this help?
                // Is this topic new? (assuming they are logged in!)
                if ($topic['new'] && $context['user']['is_logged'])



The problem is not with the block itself perse J.A. . The block "new" image dissapears after it has been read, the new image on the forum itself does not change to the read image, you have to go back to the forum itself and "mark all as read" to get the images to switch.

hsdk

#201
Hi, i need a little bit of help. (Okey, i really need a lot of help ! :laugh: )

I use this to display my 50 most recent threads


global $scripturl;
$what=ssi_recentTopics('50', NULL, 'array');

echo '<blockquote><table border="0" width="100%" cellspacing="1" cellpadding="4" class="windowbg">';
echo '<tr class="titlebg"><td valign="middle"><b>Siste 50 innlegg fra forumet:
</b></td><td>Forum</td><td valign="middle">Forfatter</td><td>Tidspunkt</td></tr>';

foreach ($what as $topic)
  {
    echo '<tr><td class="smalltext" valign="middle">', $topic['link'];
    // Is this topic new? (assuming they are logged in!)
    if (!$topic['new'] && $context['user']['is_logged'])
      echo '<a href="', $scripturl, '?topic=', $topic['topic'], '.from', $topic['time'], '#new"><img src="', $settings['images_url'], '/', $context['user']['language'], '/new.gif" alt="', $txt[302], '" border="0" /></a>';
      echo '</td><td class="smalltext" valign="middle" >', $topic['board']['link'], '</td>';
      echo '</td><td class="smalltext" valign="middle" >', $topic['poster']['link'], '</td><td class="smalltext" valign="middle" >';
      if ($settings['images_url'] != $settings['theme_url'] . '/images' || file_exists($settings['theme_dir'] . '/images/icons/last_post.gif'))
      echo '<a href="', $topic['href'], '"><img src="', $settings['images_url'], '/icons/last_post.gif" alt="', $txt[111], '" title="', $txt[111], '" border="0" style="float: right;" /></a>';
      echo '<span class="smalltext">', $topic['time'], '</span></td></tr>';
  }

echo '</blockquote></table>';


Now, this is what i want to do:

1) make a similar page that shows threads from a single specific board
2) make a page that shows a user only his post from the same board

Could this be done? How? Can someone help? :)


Best Regards
Andreas

pvcblue

Quote from: hsdk on November 27, 2006, 03:54:40 PM
Hi, i need a little bit of help. (Okey, i really need a lot of help ! :laugh: )

I use this to display my 50 most recent threads


global $scripturl;
$what=ssi_recentTopics('50', NULL, 'array');

echo '<blockquote><table border="0" width="100%" cellspacing="1" cellpadding="4" class="windowbg">';
echo '<tr class="titlebg"><td valign="middle"><b>Siste 50 innlegg fra forumet:
</b></td><td>Forum</td><td valign="middle">Forfatter</td><td>Tidspunkt</td></tr>';

foreach ($what as $topic)
  {
    echo '<tr><td class="smalltext" valign="middle">', $topic['link'];
    // Is this topic new? (assuming they are logged in!)
    if (!$topic['new'] && $context['user']['is_logged'])
      echo '<a href="', $scripturl, '?topic=', $topic['topic'], '.from', $topic['time'], '#new"><img src="', $settings['images_url'], '/', $context['user']['language'], '/new.gif" alt="', $txt[302], '" border="0" /></a>';
      echo '</td><td class="smalltext" valign="middle" >', $topic['board']['link'], '</td>';
      echo '</td><td class="smalltext" valign="middle" >', $topic['poster']['link'], '</td><td class="smalltext" valign="middle" >';
      if ($settings['images_url'] != $settings['theme_url'] . '/images' || file_exists($settings['theme_dir'] . '/images/icons/last_post.gif'))
      echo '<a href="', $topic['href'], '"><img src="', $settings['images_url'], '/icons/last_post.gif" alt="', $txt[111], '" title="', $txt[111], '" border="0" style="float: right;" /></a>';
      echo '<span class="smalltext">', $topic['time'], '</span></td></tr>';
  }

echo '</blockquote></table>';


Now, this is what i want to do:

1) make a similar page that shows threads from a single specific board
2) make a page that shows a user only his post from the same board

Could this be done? How? Can someone help? :)


Best Regards
Andreas

this was done back near the beginning of this thread

hsdk

#203
Quote from: pvcblue on November 27, 2006, 04:27:18 PM
this was done back near the beginning of this thread

Ups, sorry! Will look for it! Exactly this? im kind of a newbie at this php thing, so kind of need help with making the output look the same as my "recent 50" :)

Thanks!


Edit:


Okey i now have the first thing i wanted. But i have a problem

when using this:


global $scripturl;
$what=ssi_recentTopics('100',array('1','2','3','5','6','7','8','9','10','11','12','13','14','15','16','17','18','19','20','21','22','23'), 'array');

echo '<blockquote><table border="0" width="500" cellspacing="1" cellpadding="4" class="windowbg">';
echo '<tr class="titlebg"><td valign="middle"><b>Dykkested:
</b></td><td valign="middle">Logget av:</td></tr>';

foreach ($what as $topic)
  {
    echo '<tr><td class="smalltext" valign="middle">', $topic['link'];
    // Is this topic new? (assuming they are logged in!)
    //echo '</td><td class="smalltext" valign="middle" >', $topic['board']['link'], '</td>';
      echo '</td><td class="smalltext" valign="middle" >', $topic['poster']['link'], '</td><td class="smalltext" valign="middle" >';

//if ($settings['images_url'] != $settings['theme_url'] . '/images' || file_exists($settings['theme_dir'] .   
// '/images/icons/last_post.gif'))
//echo '<a href="', $topic['href'], '"><img src="', $settings['images_url'], '/icons/last_post.gif" alt="', $txt[111], '" //title="', $txt[111], '" border="0" style="float: right;" /></a>';
//echo '<span class="smalltext">', $topic['time'], '</span></td></tr>';
  }

echo '</blockquote></table>';


It just gives me the last three topics? i can set the number as high as 1000 and it still only returns 3.
An it shows a link to the newst post in the actual topic, i want a link to the first post, and i will show the name of the user that created the topic, not the name of the one with the last post. :-(

Edit2: Okey, so i figured out that this had to be changed in the recent topics function in ssi.php, so i made a copy called ssi_recentTopics2, and tried to make the changes, but i i screwed it up, and had to go back to a backup off ssi, the hole site went down :)

Anybody up for the challenge?

A


Edit 3: I nailed it :) Even tough i think my quyrey to the databas is way to overkill, as i just twaked the output to suit my needs.

bloc

Quote from: hartiberlin on November 27, 2006, 04:52:08 AM
Hello,
thanks for all the updates,
but I know have an urgent problem with my hoster.

It says:
There has been a problem with the database!
MySQL reported:
User "hartiberlin" has exceeded the 'max_questions' resource (current value: 70000)

This is a notice email to let you know that SMF could not connect to the database, contact your host if this continues.


Does this Recent Topic use so many queries to the database ?

It seems, my just 39 onliline users at the moment generate
more than 70.000 queries in ONE HOUR ?!

Could this be, or is someone trying to download the whole
forum with a tool or is Google spidering the whole website ?


Sounds you have some kind of loop somwhere. Because even if 39 users fetches 100 topics each, each suer use 1-2 queries for it. But this sounds like a query inside a loop or something.

jacortina

Bloc, when I display this thread, the stats at the bottom of the page are:
Page created in 0.497 seconds with 37 queries.


bloc

#206
Yes..but the recent topics query alone has afaik 1-2 queries. Of course the whole forum script + TP will add up.

Edit: I see now he wrote "1 hour" :) ..the big number might then be correct. If we reckon each user clicks once pr.minute and there are 30 users: 30x60x25(approx) queryies. thats roughly 45.000 queires per hour.

Techdomain

Have to admit - I have never heard of a server having a query limit!

bloc

No, me either..but thats maybe part of some hosting plans, i don't know.

jacortina