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

Recent

Welcome to TinyPortal. Please login or sign up.

May 19, 2024, 03:35:35 PM

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

"recent topics" in SMF style

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

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Xarcell

There are a few other ways, but I couldn't just write up the script for you right here. I would have to go and play with it, which I don't have time right now.

Is your site at a set width, or is it fluid?

If it's a set width, you can just set the width of the bocks. Otherwise trying applying width percentages to all the tablecells of the block.

like I said, it would require some experimentation.

Try:

FIND:

                                        <td class="windowbg" valign="middle">
                                                ', $topic['link'];


REPLACE WITH:

                                        <td class="windowbg" valign="middle" width="45%">
                                                ', $topic['link'];


That should be in the code anyways.

ricardo3523

For some reason my account was deleted?

Anyways..
To Ichbin, I tried installing the 1.0 beta 4 TP with the package installer but it said I already had the same version.. so I suppose I should be able to set a width for the blocks??

To Xarcell, I implemented the code, and it moved the widths around a bit, but still with equal numbers the one with the largest text in its box was displaying larger.

ZarPrime

#572
ricardo3523,

The deletion of your account was unfortunate.  Sorry this happened.  It is likely that this was due to Bloc's recent move to a newer and more powerful server.  I would guess that you joined up quite recently and the backup that Bloc used to restore the Forum was somehow missing not only your account information but possibly a few others.  Anyway, I'm glad you found your way back in.

Anyway, back to your issue.  Did you do the upgrade to TP 1.0 beta 4 without uninstalling TP 0.98 first?  Can you please give us a link to your site that shows the behavior you are talking about so that we can see it in action.  Actually, a screenshot of the panel Admin section for the particular panel you are using would be nice as well.  While you are at it, it might be best to use the posting template in the Posting Guidelines to tell us as much about your site as you can.

ZarPrime

Xarcell

#573
@ ricardo3523

Can I see the example you are using at your site? I need to see an live example of what your trying to do.

Sorry about your account being deleted. Bloc moved servers and we lost some stuff during the move.

ricardo3523

@ZarPrime.  No I did not tried to uninstall any previous TP version.

Link to my site: www.hyperion-legion.com
SMF version: Forum version: SMF 1.1.11
Current SMF version: SMF 1.1.11
TP version: No idea.
Theme name and version: AionRed
Browser Name and Version: Mozzila firefox..
Mods installed: Aside from gallery that came with the hosting, none.
Related Error messages: None.

Xarcell

So your trying to place to recent topic blocks side by side in a upper panel block?

Untested, but try:
global $scripturl;

echo '
<div style="position: relative; padding: 0px; margin: 0px;">';
  echo '
      <div style="position: absolute; left: 0px; top: 0px; width: 49%;">';

echo '
                        <table border="0" width="100%" cellspacing="1" cellpadding="4" class="bordercolor">
                               <tr><td colspan="3" class="titlebg">Recent topics</td></tr> ';
       $what=ssi_recentTopics('8', array('1','112','47','52','36','49','37','51','192','8') , '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['new_from'], '#new"><img src="', $settings['images_url'], '/', $context['user']['language'], '/new.gif" alt="', $txt[302], '" border="0" /></a>';

                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;" /></a>';
                echo '
                                                <span class="smalltext">
                                                        ', $topic['time'], '
                                                </span>
                                        </td>
                                </tr>';
        }

        echo '
                        </table>';
          echo '</div>';
         
          echo '
                <div style="position: absolute; right: 0px; top: 0px; width: 49%;">';
                                        <table border="0" width="100%" cellspacing="1" cellpadding="4" class="bordercolor">
                               <tr><td colspan="3" class="titlebg">Recent topics</td></tr> ';
       $what=ssi_recentTopics('8', array('1','112','47','52','36','49','37','51','192','8') , '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['new_from'], '#new"><img src="', $settings['images_url'], '/', $context['user']['language'], '/new.gif" alt="', $txt[302], '" border="0" /></a>';

                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;" /></a>';
                echo '
                                                <span class="smalltext">
                                                        ', $topic['time'], '
                                                </span>
                                        </td>
                                </tr>';
        }

        echo '
                        </table>';
                       
                   echo '</div>';
    echo '</div>';


Adjust the array to your board ID's. Let me know if it works.

ricardo3523

#576
QuoteParse error: syntax error, unexpected '<' in /home/ensidial/public_html/Sources/Load.php(1742) : eval()'d code(52) : eval()'d code on line 49

Currently being displayed on the spot where the block should appear.

Xarcell

Quote from: ricardo3523 on March 29, 2010, 07:31:01 AM
QuoteParse error: syntax error, unexpected '<' in /home/ensidial/public_html/Sources/Load.php(1742) : eval()'d code(52) : eval()'d code on line 49

Currently being displayed on the spot where the block should appear.


oops.  use this instead.

global $scripturl;

echo '
<div style="position: relative; padding: 0px; margin: 0px;">';
  echo '
      <div style="position: absolute; left: 0px; top: 0px; width: 49%;">';

echo '
                        <table border="0" width="100%" cellspacing="1" cellpadding="4" class="bordercolor">
                               <tr><td colspan="3" class="titlebg">Recent topics</td></tr> ';
       $what=ssi_recentTopics('8', array('1','112','47','52','36','49','37','51','192','8') , '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['new_from'], '#new"><img src="', $settings['images_url'], '/', $context['user']['language'], '/new.gif" alt="', $txt[302], '" border="0" /></a>';

                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;" /></a>';
                echo '
                                                <span class="smalltext">
                                                        ', $topic['time'], '
                                                </span>
                                        </td>
                                </tr>';
        }

        echo '
                        </table>';
          echo '</div>';
         
          echo '
                <div style="position: absolute; right: 0px; top: 0px; width: 49%;">';
               
                echo '
                                        <table border="0" width="100%" cellspacing="1" cellpadding="4" class="bordercolor">
                               <tr><td colspan="3" class="titlebg">Recent topics</td></tr> ';
       $what=ssi_recentTopics('8', array('1','112','47','52','36','49','37','51','192','8') , '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['new_from'], '#new"><img src="', $settings['images_url'], '/', $context['user']['language'], '/new.gif" alt="', $txt[302], '" border="0" /></a>';

                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;" /></a>';
                echo '
                                                <span class="smalltext">
                                                        ', $topic['time'], '
                                                </span>
                                        </td>
                                </tr>';
        }

        echo '
                        </table>';
                       
                   echo '</div>';
    echo '</div>';

ricardo3523

#578
Implemented it in both blocks. Result in attachement.
When I just did it with one block the other block ( so in different code ) was displayed behind it, as you see the front page posts now behind those blocks, suddenly it are four.

Xarcell

The code I gave only needs one block, or posted once.

Also, you may need to add a height to the first div in the script.

ex: <div style="position: relative; height: 500px; padding: 0px; margin: 0px;">';