SimplePortal

Customization => Custom Coding => Topic started by: hdhoran on March 29, 2009, 02:09:35 PM

Title: Recent post code modification?
Post by: hdhoran on March 29, 2009, 02:09:35 PM
I am very new to Simple Portal...have been using TP since I started using SMF....but went with SP because I wanted to use SMF2.0...

I don't understand how to make different blocks do what I want them to do. One of my favorite blocks with TP used this block snippet

Quote
       
global $scripturl;

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', 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['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>';

To make the recent topics blend better with SMF.

I guess what I'm asking is can this code be made to work with SP? I much prefer the look of the code above but have no idea what to do with it since it doesn't work on it's own now.

Can someone help me? Any help would be greatly appreciated.
Title: Re: Recent post code modification?
Post by: hdhoran on March 30, 2009, 10:57:48 PM
Wow...seriously? I figured somebody would be able to adapt this to work with Simple Portal fairly easily....

I wish I knew more about it, I would attempt it. But I know I'm a dunce. lol

Nobody?
Title: Re: Recent post code modification?
Post by: Immortal on March 30, 2009, 11:14:00 PM
Well ...you should know that we just don't refresh forum all the time and we actually have a normal life too (Jade is an exception thou :P).

Now seriously, the code you pasted..hm you want different style for Recent Topics block?

This will be pretty easy to do with SP 2.2, which should be out soon for everyone.

Adapting this to work with SP 2.1 atm is quite pointless (unless you're not going to update SP when 2.2 is out).
Title: Re: Recent post code modification?
Post by: hdhoran on March 31, 2009, 05:00:24 PM
 :P Oh believe me I have no doubt everyone has a life...myself included...lol...sorry I'm just a little anxious to have my forums back to "normal" and was impatient! My apologies!

I have no plans to upgrade or update anytime soon....upgrading is what got me into a huge mess with my forums down for almost 3 weeks while I fixed it.....but if that's what I have to do to get the code modified, then I guess that's what I have to do.

Thanks for the response!

 ;D
Title: Re: Recent post code modification?
Post by: Immortal on March 31, 2009, 05:51:16 PM
Don't worry update process to SP 2.2 is straight-forward. You will need to uninstall SP 2.1 and install 2.2 - no data lose and won't take you even 5 minutes. :)
Title: Re: Recent post code modification?
Post by: [SiNaN] on April 09, 2009, 03:41:26 AM
You don't have to adapt anything. Just do this:

Admin > SimplePortal > Blocks > Add Block

select "Custom PHP" block.

Add your codes to the textarea and click "Add Block". You're done!
SimplePortal 2.3.8 © 2008-2024, SimplePortal