Login  |  Register
HTML5 Icon HTML5 Icon HTML5 Icon
TP on Social Media

Recent

Welcome, Guest. Please login or register.
Did you miss your activation email?

August 11, 2022, 08:51:23 AM

Login with username, password and session length
Members
  • Total Members: 3842
  • Latest: Kokoro
Stats
  • Total Posts: 193479
  • Total Topics: 21088
  • Online today: 52
  • Online ever: 1035
  • (November 26, 2020, 04:45:12 AM)
Users Online
Users: 1
Guests: 49
Total: 50

Author Topic: "recent topics" in SMF style  (Read 266128 times)

0 Members and 2 Guests are viewing this topic.

sp0di

  • Guest
Re: "recent topics" in SMF style
« Reply #10 on: August 20, 2005, 07:37:01 AM »
Also, it is possible to show this at the bottom rather than the top?  I have been looing for how to do that - but cannot seem to find it...

Offline IchBin

  • Friends
  • *
  • Posts: 16231
Re: "recent topics" in SMF style
« Reply #11 on: August 20, 2005, 09:38:23 AM »
I think that depends on what you want at the top. What would you have above the recent topics?

Offline Nokonium

  • Aging Hippie
  • Friends
  • *
  • Posts: 1384
    • Our-Local
Re: "recent topics" in SMF style
« Reply #12 on: August 21, 2005, 03:09:30 AM »
I've nearly finished what I'm doing with the block code. Even one page should show as Pages: [1] but I haven't got the page number to display yet.

[code]        global $context, $settings, $options, $txt, $scripturl, $modSettings;
echo '
<table border="0" width="100%" cellspacing="1" cellpadding="4" class="tborder">
<tr><td class="titlebg"><strong>Recent topics</strong></td></tr></table><table border="0" width="100%" cellspacing="1" cellpadding="4" class="tborder"><tr><td class="catbg">These are our most recent topics</td></tr></table>';


echo '
<table width="100%" cellpadding="3" cellspacing="0" border="0" class="tborder" style="margin-bottom: 3px;margin-top: 3px;">
        <tr>
                <td align="left" class="catbg" width="100%" height="35">
                        <table cellpadding="3" cellspacing="0" width="100%">
                                <tr>
                                        <td>
                                                ', $txt[139], ': ', $context['page_index'];

        // Show a "go down" link?
        if (!empty($modSettings['topbottomEnable']))
                echo $context['menu_separator'], '<a href="#bot">', $settings['use_image_buttons'] ? '<img src="' . $settings['images_url'] . '/' . $context['user']['language'] . '/go_down.gif" alt="' . $txt['topbottom5'] . '" border="0" align="top" />' : $txt['topbottom5'], '[/url]';

        echo '
                                        </td>

                                </tr>
                        </table>
                </td>
        </tr>
</table>

<a name="top">[/url]

<table border="0" width="100%" cellspacing="1" cellpadding="4" class="tborder"><tr><td  class="titlebg">Subject</td><td  class="titlebg">Started By</td><td  class="titlebg">Last Post</td></tr>';
       $what=ssi_recentTopics('8', NULL, 'array');


        foreach ($what as $topic)
        {
                echo '
                                <tr>
                                        <td class="windowbg" 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['newtime'], '#new"><img src="', $settings['images_url'], '/', $context['user']['language'], '/new.gif" alt="', $txt[302], '" border="0" />[/url]';

                echo '
                                        </td>
                                        <td class="windowbg2" valign="middle" width="20%">
                                                ', $topic['poster']['link'], '
                                        </td>
                                        <td class="windowbg2" valign="middle" width="35%">';
                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;" />[/url]';
                echo '
                                                <span class="smalltext">
                                                        ', $topic['time'], '
                                                </span>
                                        </td>
                                </tr>';
        }

        echo '
                        </table>
        <a name="lastPost">[/url]
                        <table width="100%" cellpadding="3" cellspacing="0" border="0" class="tborder" style="margin-top: 1ex;">
        <tr>
  Ãâ€Å
« Last Edit: August 21, 2005, 05:45:42 AM by nokonium »

Bjørn

  • Guest
Re: "recent topics" in SMF style
« Reply #13 on: August 21, 2005, 06:08:07 AM »
"page index" is calculated by SMF..but since you don't use SMF directly, but rather SSi..you need to do the calculating yourself. It depends upon how many posts you have fetched in the functiona and how many you like to display at one time...you would even need to transfer a variable that says "display from page 2" ( in other words skip x number of posts and then display).

I would just stick to 1 page and adjust the number "8" to your own needs.TP calculates pages for its articles and forum posts..but its perhaps difficult to transfer this approach to a block code.

Offline Nokonium

  • Aging Hippie
  • Friends
  • *
  • Posts: 1384
    • Our-Local
Re: "recent topics" in SMF style
« Reply #14 on: August 21, 2005, 07:42:48 AM »
Thanks Block

How many pages will be called by your Block code, would it only be one? Even if it was say 50 topics long?

Bjørn

  • Guest
Re: "recent topics" in SMF style
« Reply #15 on: August 21, 2005, 11:32:47 AM »
If you look at the code..only 8 ? thats what you meant?

Offline Nokonium

  • Aging Hippie
  • Friends
  • *
  • Posts: 1384
    • Our-Local
Re: "recent topics" in SMF style
« Reply #16 on: August 21, 2005, 01:19:22 PM »
No, that is all the posts made on the last day before I made that database copy, it is set for 10. What I meant was, can the Recent Topics SSI paginate all the topics it finds or would it display them in one long page, if it was set to say 50?

I have now removed both page_index variables and got rid of two of the three errors. The frontblock error I have added to the 0.72b thread as that is my current version.

Bjørn

  • Guest
Re: "recent topics" in SMF style
« Reply #17 on: August 22, 2005, 06:21:12 AM »
It would display them in one long line.

Recent topics only show subjects anyway, whereas "ssi_boardnews" shows posts..and thats what TP already use when showing last post from the forum - on the frontpage. TP asks a modified version of this function for the data, but calculates pagination and also add any page number needed in the querystring. Ssi_recenttopics out-of-the-box doesn not support fetching of x data from y starting point..it only fetches all, only limited by your "limit" number.

Offline Ray

  • Sr. Member
  • ****
  • Posts: 446
Re: "recent topics" in SMF style
« Reply #18 on: August 22, 2005, 09:51:51 AM »
How could I make this to work in the center blocs??

http://www.rranderson.com/dvd/index.php?action=recent

Bjørn

  • Guest
Re: "recent topics" in SMF style
« Reply #19 on: August 22, 2005, 04:20:37 PM »
You can't. It has its own template and fetching routine, and will not work inside another "action" - namely "action=tportal".