Here is php code for Recent Topic with avatar and popup preview

Started by rocknroller, August 16, 2011, 05:31:02 PM

Previous topic - Next topic

rocknroller

Quotehere is php code for php block, you can easy use it with portals.  :)

..::Recent Topic with avatar and popup preview::..




/**
* @author logooff.net
*/

//SETUP

$number_of_posts =10; // here you can change number of posts
$default_avatar = 'http://www.pohrani.com/f/45/mu/1bzggGqq/noavatar.png'; // enter URL of default avatar you want. Like this 'http://www.url.com/image.jpg'


//SETUP END
global $contex, $txt, $settings;
$array = ssi_recentTopics($number_of_posts, null, null, 'array');
echo '
<table class="side_class_row">
          <tr>
              <td>', $txt['replies'], '</td>
              <td colspan="4"></td>
          </tr>';
foreach ($array as $post)
{

global $memberContext;
      loadMemberData($post['poster']['id']);
      loadMemberContext($post['poster']['id']);

echo '
  <tr>
<td class="side_class_replies">', $post['replies'], '</td>
            <td  class="side_class_new">';
                if (!empty($post['new']) )
                    echo'';
                else
                    echo'
                    <img src="' . $settings['lang_images_url'] . '/new.gif" class="new_posts" alt="new" />';
             echo'
            </td>
            <td></td>
    <td><div class="triangle-isosceles" id="a', $post['topic'], '" style="display: none">', $post['preview'], '</div>
                    <a href="'. $post['href']. '" target="_self" onmouseover="document.getElementById(\'a', $post['topic'], '\').style.display = \'block\'" onmouseout="document.getElementById(\'a', $post['topic'], '\').style.display = \'none\'">', $post['short_subject'], '</a>
             </td>
<td>';
            if (!empty($memberContext[$post['poster']['id']]['avatar']['href'])){
echo '<img src="' . $memberContext[$post['poster']['id']]['avatar']['href'] . '" width="30" height="30" alt="', $post['poster']['name'], '" />';
                    }           
            else {
echo '<img src="' . $default_avatar .'" alt="default_avatar" width="30" height="30" />';
                }
        echo'
            </td>
            <td class="side_class_poster"><pre> ', $post['poster']['link'], ' </pre> </td>
    </tr>
        <tr>
            <td colspan="6"><hr /></td>
        </tr>';
}
echo '
    </table>
<style type="text/css">
.side_class_poster pre
{
     font-size:10px;
}
.side_class_row
{
     padding:4px;
     width: 100%;
}
td.side_class_replies
{
     text-align:center;
     width:3%;
}
td.side_class_new
{
     text-align:center;
     width:3%;
}
.triangle-isosceles {
    position: fixed;
    top: 300px;
    left: 400px;
    padding:15px;
    margin:1em 0 3em;
    color:#fff;
    max-width: 400px;
    border: 1px solid #222222;
    -moz-border-radius:10px;
    -webkit-border-radius:10px;
    border-radius:10px;
    -moz-box-shadow: 3px 3px 39px 2px #222222;
    -webkit-box-shadow: 3px 3px 39px 2px #222222;
    box-shadow: 3px 3px 39px 2px #222222;
    background: -moz-linear-gradient(top, rgba(41,137,216,0.9) 0%, rgba(30,87,153,0.9) 94%, rgba(30,87,153,0.9) 100%);
    background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,rgba(41,137,216,0.9)), color-stop(94%,rgba(30,87,153,0.9)), color-stop(100%,rgba(30,87,153,0.9)));
    background: -webkit-linear-gradient(top, rgba(41,137,216,0.9) 0%,rgba(30,87,153,0.9) 94%,rgba(30,87,153,0.9) 100%);
    background: -o-linear-gradient(top, rgba(41,137,216,0.9) 0%,rgba(30,87,153,0.9) 94%,rgba(30,87,153,0.9) 100%);
    background: -ms-linear-gradient(top, rgba(41,137,216,0.9) 0%,rgba(30,87,153,0.9) 94%,rgba(30,87,153,0.9) 100%);
    background: linear-gradient(top, rgba(41,137,216,0.9) 0%,rgba(30,87,153,0.9) 94%,rgba(30,87,153,0.9) 100%);
    }
</style>';



Enjoy!

thx to blue for avatar.

Added

  • Profile link
  • Editable Default avatar

darren1981

Thanks... but it's not working for me:

QuoteParse error: syntax error, unexpected '<' in

added it as a php block and i am getting the above error.
CSS3 Forum [nofollow] | HTML5 Forum [nofollow]

Hj Ahmad Rasyid Hj Ismail

Interesting... How would it looks when being used? Any pictures/images?

rocknroller

Quote from: darren1981 on August 16, 2011, 10:44:16 PM
Thanks... but it's not working for me:

QuoteParse error: syntax error, unexpected '<' in

added it as a php block and i am getting the above error.

Which of portal you are using on your forum?

Quote from: ahrasis on August 17, 2011, 03:22:44 AM
Interesting... How would it looks when being used? Any pictures/images?
looks different on each theme:



demo is available here in left column.

darren1981

This looks awesome.. would also love to add it to my forum... i am using "PortaMX" as my portal as it best suits my requirements for now.. i played around with it for about 15mins and still couldn't get it to work.. just kept showing that error.

Your site / Demo looks great by the way... Cheers for any help on this.

Regards, Darren
CSS3 Forum [nofollow] | HTML5 Forum [nofollow]

rocknroller

Quote from: darren1981 on August 18, 2011, 01:43:21 AM
This looks awesome.. would also love to add it to my forum... i am using "PortaMX" as my portal as it best suits my requirements for now.. i played around with it for about 15mins and still couldn't get it to work.. just kept showing that error.

Your site / Demo looks great by the way... Cheers for any help on this.

Regards, Darren

try now! it should be works!

darren1981

Thanks Bud :)

Working a treat now, cheers for that.. i did try to resolve / modify it myself but with little luck :(
CSS3 Forum [nofollow] | HTML5 Forum [nofollow]

rocknroller

Quote from: darren1981 on August 18, 2011, 11:49:19 PM
Thanks Bud :)

Working a treat now, cheers for that.. i did try to resolve / modify it myself but with little luck :(

no problem,  :) enjoy.

I will add more setup functions very soon.

teos55

   Great tip, thanks.  Is there a way to make the block scrollable ? I want to see 20 recent topics but takes to much space on the screen.

Advertisement: