collapse

* User Info

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

* Who's Online

  • Dot Guests: 51
  • Dot Hidden: 0
  • Dot Users: 1
  • Dot Users Online:

* Shoutbox

Refresh History
  • Shoutbox is not for support!
  • Nakroma: am I dumb or is there actually no tutorial? [link]
    Today at 08:29:41 AM
  • AngelinaBelle: Welcome Gusto Prod.  Please visit [link] for info on creating an SMF forum
    Yesterday at 12:04:00 PM
  • GUSTO PROD: hi all give me creat new forum free
    April 16, 2014, 12:21:54 PM
  • AngelinaBelle: Hello w1ck3d! Welcome to Simple Portal. Unfortunately, there are not Russian speakers here very often.  Aplogies
    April 14, 2014, 07:49:26 AM
  • w1ck3d: тест
    April 14, 2014, 02:50:12 AM
  • Underdog: How to use Simple Portal for SMF: [link]
    April 02, 2014, 07:52:45 PM
  • Underdog: Thariq, please post questions in the forum. thank you.
    April 02, 2014, 07:51:40 PM
  • Thariq: how to create portal/site
    April 02, 2014, 06:30:42 AM
  • Ali çelen: forum nasıl oluştırıcam
    March 30, 2014, 10:59:08 PM
  • Ali çelen: sa
    March 30, 2014, 10:58:54 PM
  • AngelinaBelle: processor -- I think your customization will probably be just fine.
    February 14, 2014, 07:18:41 PM
  • AngelinaBelle: noumankhan: Welcome to SimplePortal.  Please read the documentation above. If you have questions about how to make a forum, please seek help at [link]
    February 14, 2014, 07:16:45 PM
  • noumankhan: how can i make forum plz tell me
    February 13, 2014, 09:41:03 AM
  • noumankhan: hello
    February 13, 2014, 09:40:47 AM
  • BurkeKnight: Shoutbox is not for support. That also means, not for asking volunteers to hurry to your support topic. All topics will get seen. :)
    February 12, 2014, 03:39:28 PM
  • processor: Can anyone check this out: [link] thanks guys
    February 12, 2014, 05:54:58 AM
  • matixto: Hi all, can a developer see this thread? [link] Thanks!
    February 06, 2014, 02:44:36 PM
  • imamzw: Halo
    February 05, 2014, 08:17:24 PM
  • dj_king: hello
    February 04, 2014, 10:32:47 AM
  • BurkeKnight: Thank you, old friend :)
    January 29, 2014, 07:01:43 AM

* Team Blog

* Recent Posts

Re: Help with site by USFA
[Today at 08:57:16 AM]


Re: Hi, I am created pages but. by USFA
[Today at 08:53:32 AM]


Re: Shoutbox refresh and page reload discrepancy by w1ck3d
[Today at 03:14:17 AM]


Re: Shoutbox refresh and page reload discrepancy by w1ck3d
[Today at 03:13:00 AM]


Re: Help with site by michelineney
[Today at 01:27:41 AM]

If you're interested in helping other members with support requests, consider joining the Community Support Helpers group.

Author Topic: Recent topic with popup  (Read 2911 times)

0 Members and 1 Guest are viewing this topic.

Offline rocknroller

  • Jr. Member
  • **
  • Posts: 55
  • Gender: Male
  • Simple portal is great
    • LogoOff Theme club for SMF®
  • SMF Version: 2 RC5
  • SP Version: 2.3.3
Recent topic with popup
« on: June 25, 2011, 02:20:49 AM »
..::Recent Topic with avatar and popup preview::..
Verson 1.2


Code: [Select]
/**
 * Recent Topic with avatar and popup preview
 * Version 1.2
 * @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">';
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></td>
    </tr>
        <tr>
            <td colspan="6"><p class="side_class_poster"><span class="floatleft">', $txt['replies'], '</span> ', $post['poster']['link'], ' </p><hr class="side_hr" /></td>
        </tr>';
}
echo '
    </table>
<style type="text/css">
.side_class_poster
{
     font-size:10px;
     margin: 0;
     padding: 0;
     text-align: right;
}
table.side_class_row hr
     margin: 0;
     padding: 0;
}
.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!


29.08.2011
Version 1.2
  • Added Setupable avatar


16.07.2011
  • Added avatar (thanx to blue)
  • Fixed XHTML validation
  • Added setup for number of posts
« Last Edit: August 29, 2011, 10:03:41 AM by rocknroller »
                 
»  TOTM winner - Glacier

Offline Blue

  • Customizer
  • *
  • Posts: 378
  • Gender: Male
  • Block Maker? =P
Re: Recent topic with popup
« Reply #1 on: July 03, 2011, 07:59:47 AM »
Here, try this:

Code: [Select]
<?php

$array 
ssi_recentTopics(10nullnull'array');
global 
$contex$txt$settings;
echo 
'
<table class="side_class_row">
        <thead>
            <tr>
                <td>'
$txt['replies'], '</td>
                <td></td>
                <td></td>
<td></td>
                <td></td>
            </tr>
        <thead>'
;
foreach (
$array as $post)
{

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


echo 
'
        <tbody>
  <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="" />';
             echo
'
                </td>
                <td></td>
     <td>
                    <div class="triangle-isosceles" id="'
$post['topic'], '" style="display: none">'$post['preview'], '</div>
                    <a href="'
$post['href']. '" target="_self" onmouseover="document.getElementById(\''$post['topic'], '\').style.display = \'block\'" onmouseout="document.getElementById(\''$post['topic'], '\').style.display = \'none\'">'$post['short_subject'], '</a>
                </td>
<td><img src="' 
$memberContext[$post['poster']['id']]['avatar']['href'] . '" width="30px" height="30px" /></td>
                <td class="side_class_poster"><pre> '
$post['poster']['name'], ' </pre> </td>
     </tr>
            <tr>
                <td colspan="5"><hr></td>
            </tr>
        </tbody>'
;
}
echo 
'
    </table> 
<style> 
.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>'
;

?>
Please to keep this website running, if you like SimplePortal, make a
one-time subscription. Thank you for your support.

Offline agent47

  • Jr. Member
  • **
  • Posts: 63
  • SMF Version: 2 RC5
  • SP Version: 2.3.3
Re: Recent topic with popup
« Reply #2 on: July 03, 2011, 09:19:48 AM »
Wow this looks so awesome.... I wish someone would implement this for this mod. It'll look so awesome.

Offline Blue

  • Customizer
  • *
  • Posts: 378
  • Gender: Male
  • Block Maker? =P
Re: Recent topic with popup
« Reply #3 on: July 03, 2011, 09:32:40 AM »
I have to re-do that block since that was my first block ever  ;P

Maybe, when I start I'll ask rocknroller if I can use his code.
Please to keep this website running, if you like SimplePortal, make a
one-time subscription. Thank you for your support.

Offline rocknroller

  • Jr. Member
  • **
  • Posts: 55
  • Gender: Male
  • Simple portal is great
    • LogoOff Theme club for SMF®
  • SMF Version: 2 RC5
  • SP Version: 2.3.3
Re: Recent topic with popup
« Reply #4 on: July 03, 2011, 09:44:25 AM »
I have to re-do that block since that was my first block ever  ;P

Maybe, when I start I'll ask rocknroller if I can use his code.

tnx friend for avatar, sure you can use it. I'm glad that someone like this code.  :D
                 
»  TOTM winner - Glacier

Offline Blue

  • Customizer
  • *
  • Posts: 378
  • Gender: Male
  • Block Maker? =P
Re: Recent topic with popup
« Reply #5 on: July 03, 2011, 10:01:39 AM »
Glad I could help ;)
Please to keep this website running, if you like SimplePortal, make a
one-time subscription. Thank you for your support.

Offline agent47

  • Jr. Member
  • **
  • Posts: 63
  • SMF Version: 2 RC5
  • SP Version: 2.3.3
Re: Recent topic with popup
« Reply #6 on: July 03, 2011, 10:07:23 AM »
You guys rule!

Offline S@ffz

  • Jr. Member
  • **
  • Posts: 58
  • SMF Version: 2.0.2
  • SP Version: 2.3.5
Re: Recent topic with popup
« Reply #7 on: August 11, 2011, 07:26:28 PM »
I have to re-do that block since that was my first block ever  ;P

Maybe, when I start I'll ask rocknroller if I can use his code.

Are you still going too Blue?
 is it possible to reduce the amount of topics displayed?
« Last Edit: August 11, 2011, 07:30:36 PM by saffz »

Offline rocknroller

  • Jr. Member
  • **
  • Posts: 55
  • Gender: Male
  • Simple portal is great
    • LogoOff Theme club for SMF®
  • SMF Version: 2 RC5
  • SP Version: 2.3.3
Re: Recent topic with popup
« Reply #8 on: August 16, 2011, 03:18:41 PM »
I have to re-do that block since that was my first block ever  ;P

Maybe, when I start I'll ask rocknroller if I can use his code.

Are you still going too Blue?
is it possible to reduce the amount of topics displayed?

Edited first post.. :)
                 
»  TOTM winner - Glacier

Offline S@ffz

  • Jr. Member
  • **
  • Posts: 58
  • SMF Version: 2.0.2
  • SP Version: 2.3.5
Re: Recent topic with popup
« Reply #9 on: August 28, 2011, 03:59:00 PM »
Thanks rocknroller

One more Question how can I tidy the contents displayed in the block as they are very space apart and almost looks
bare.   As you can see from the attached image 5 post are displayed and there is a scroll bar at the bottom.   :(
and I don't know how or where to tidy this block.  Any help would be much appreciated.

Offline rocknroller

  • Jr. Member
  • **
  • Posts: 55
  • Gender: Male
  • Simple portal is great
    • LogoOff Theme club for SMF®
  • SMF Version: 2 RC5
  • SP Version: 2.3.3
Re: Recent topic with popup
« Reply #10 on: August 29, 2011, 09:24:31 AM »
Thanks rocknroller

One more Question how can I tidy the contents displayed in the block as they are very space apart and almost looks
bare.   As you can see from the attached image 5 post are displayed and there is a scroll bar at the bottom.   :(
and I don't know how or where to tidy this block.  Any help would be much appreciated.

i was changed code in first post today with newer version, first change the code and is still have problem send me link of your forum, so can check with firebug. :)
« Last Edit: August 29, 2011, 10:05:18 AM by rocknroller »
                 
»  TOTM winner - Glacier

Offline S@ffz

  • Jr. Member
  • **
  • Posts: 58
  • SMF Version: 2.0.2
  • SP Version: 2.3.5
Re: Recent topic with popup
« Reply #11 on: October 19, 2011, 03:14:27 AM »
Great block guys

thanks  ;D
« Last Edit: October 19, 2011, 03:19:48 AM by saffz »

Offline FrizzleFried

  • Full Member
  • ***
  • Posts: 114
  • SMF Version: 2.0.5
  • SP Version: 2.3.5
Re: Recent topic with popup
« Reply #12 on: April 04, 2012, 12:41:50 AM »
Was wondering if there is a way to limit the forums this block looks for... I have a NSFW forum i want it to ignore.

Offline fapencio

  • Semi Newbie
  • *
  • Posts: 6
  • SMF Version: 2.0.7
  • SP Version: 2.3.5
Re: Recent topic with popup
« Reply #13 on: April 04, 2014, 08:26:04 PM »
awesome! thanks  :thumbsup: :applause:

Offline Schnuffeltier

  • Semi Newbie
  • *
  • Posts: 17
  • Gender: Female
  • SMF Version: 2.0.7
  • SP Version: 2.3.5
Re: Recent topic with popup
« Reply #14 on: April 06, 2014, 11:48:53 AM »
Wow! This is really fantastic! I like the popups very much!

Would it be possible to add the popups to this code?

Code: [Select]
global $context, $settings, $scripturl, $txt;
global $user_info, $modSettings, $smcFunc, $posts;
global $color_profile;

$exclude_boards = null;
$num_recent = !empty($parameters[0]) ? $parameters[0] :  (isset($_GET['limit']) ? (int) $_GET['limit'] : 20);

if ($exclude_boards === null && !empty($modSettings['recycle_enable']) && $modSettings['recycle_board'] > 0)
$exclude_boards = array($modSettings['recycle_board']);
else
$exclude_boards = empty($exclude_boards) ? array() : $exclude_boards;

$stable_icons = array('xx', 'thumbup', 'thumbdown', 'exclamation', 'question', 'lamp', 'smiley', 'angry', 'cheesy', 'grin', 'sad', 'wink', 'moved', 'recycled', 'wireless');
$icon_sources = array();
foreach ($stable_icons as $icon)
$icon_sources[$icon] = 'images_url';

// Find all the posts in distinct topics.  Newer ones will have higher IDs.
$request = $smcFunc['db_query']('','
SELECT
m.poster_time, ms.subject, m.id_topic, m.id_member, m.id_msg, b.id_board, t.num_replies, t.num_views, b.name AS bName,
IFNULL(mem.real_name, m.poster_name) AS poster_name, ' . ($user_info['is_guest'] ? '1 AS is_read, 0 AS new_from' : '
IFNULL(lt.id_msg, IFNULL(lmr.ID_MSG, 0)) >= m.id_msg_modified AS is_read,
IFNULL(lt.id_msg, IFNULL(lmr.ID_MSG, -1)) + 1 AS new_from') . ', LEFT(m.body, 384) AS body, m.smileys_enabled, mf.icon
FROM ({db_prefix}messages AS m, {db_prefix}topics AS t, {db_prefix}boards AS b, {db_prefix}messages AS ms)
INNER JOIN {db_prefix}messages AS mf ON (mf.id_msg = t.id_first_msg)
LEFT JOIN {db_prefix}members AS mem ON (mem.id_member = m.id_member)' . (!$user_info['is_guest'] ? '
LEFT JOIN {db_prefix}log_topics AS lt ON (lt.id_topic = t.id_topic AND lt.id_member = {int:id_member})
LEFT JOIN {db_prefix}log_mark_read AS lmr ON (lmr.id_board = b.id_board AND lmr.id_member = {int:id_member})' : '') . '
WHERE t.ID_LAST_MSG >= ' . ($modSettings['maxMsgID'] - 35 * min($num_recent, 5)) . '
AND t.id_last_msg = m.id_msg
AND b.id_board = t.id_board' . (empty($exclude_boards) ? '' : '
AND b.id_board NOT IN ({array_int:exclude_boards})'). '
AND {raw:query_see_board}
AND ms.id_msg = t.id_last_msg
ORDER BY t.id_last_msg DESC
LIMIT {int:limit}',
array(
'id_member' => $user_info['id'],
'exclude_boards' => $exclude_boards,
'query_see_board' => $user_info['query_wanna_see_board'],
'limit' => (int) $num_recent,
)
);
$posts = array();
$colorids = array();
while ($row = $smcFunc['db_fetch_assoc']($request))
{
$row['body'] = strip_tags(strtr(parse_bbc($row['body'], $row['smileys_enabled'], $row['id_msg']), array('<br />' => '')));
if ($smcFunc['strlen']($row['body']) > 128)
$row['body'] = $smcFunc['substr']($row['body'], 0, 128) . '...';

// Censor the subject.
                  $row['subject'] = preg_replace('/^' . preg_quote($txt['response_prefix']) . '/', '', $row['subject']);
censorText($row['subject']);
censorText($row['body']);

//Collect the color ids :)
$colorids[$row['id_member']] = $row['id_member'];

if (empty($modSettings['messageIconChecks_disable']) && !isset($icon_sources[$row['icon']]))
$icon_sources[$row['icon']] = file_exists($settings['theme_dir'] . '/images/post/' . $row['icon'] . '.gif') ? 'images_url' : 'default_images_url';

// Build the array.
$posts[] = array(
'board' => array(
'id' => $row['id_board'],
'name' => $row['bName'],
'href' => $scripturl . '?board=' . $row['id_board'] . '.0',
'link' => '<a href="' . $scripturl . '?board=' . $row['id_board'] . '.0">' . $row['bName'] . '</a>'
),
'topic' => $row['id_topic'],
'poster' => array(
'id' => $row['id_member'],
'name' => $row['poster_name'],
'href' => empty($row['id_member']) ? '' : $scripturl . '?action=profile;u=' . $row['id_member'],
'link' => empty($row['id_member']) ? $row['poster_name'] : '<a href="' . $scripturl . '?action=profile;u=' . $row['id_member'] . '">' . $row['poster_name'] . '</a>'
),
'subject' => $row['subject'],
'short_subject' => shorten_subject($row['subject'], 25),
'preview' => $row['body'],
'time' => timeformat($row['poster_time']),
'timestamp' => forum_time(true, $row['poster_time']),
'href' => $scripturl . '?topic=' . $row['id_topic'] . '.msg' . $row['id_msg'] . ';topicseen#new',
'link' => '<a href="' . $scripturl . '?topic=' . $row['id_topic'] . '.msg' . $row['id_msg'] . '#new">' . $row['subject'] . '</a>',
'new' => !empty($row['is_read']),
'new_from' => $row['new_from'],
'icon' => '<img src="' . $settings[$icon_sources[$row['icon']]] . '/post/' . $row['icon'] . '.gif" align="middle" alt="' . $row['icon'] . '" border="0" />',
'views' => $row['num_views'],
'replies' => $row['num_replies'],
);
}
$smcFunc['db_free_result']($request);

// Load recent topic posts colors =)
if(!empty($colorids) && sp_loadColors($colorids) !== false)
foreach($posts as $k => $p)
if(!empty($color_profile[$p['poster']['id']]['link']))
$posts[$k]['poster']['link'] = $color_profile[$p['poster']['id']]['link'];

$context['recent_topics']=$posts;

// Just return it.
if (empty($posts))
return $posts;

echo '
<div class="tborder">
<table cellspacing="0" width="100%">
<tr class="catbg">

</tr>
<tr>
<td style="padding: 5px;">
</td> ';
foreach ($posts as $post)
echo '
<tr>
<td align="center" valign="middle" nowrap="nowrap">
', $post['icon'], '
</td>
<td valign="middle" width="%100">
<div style="font-size: 11px;"><b>
<a href="', $post['href'], '">', $post['subject'], '</a>
', $post['new'] ? '' : '<a href="' . $scripturl . '?topic=' . $post['topic'] . '.msg' . $post['new_from'] . ';topicseen#new"><img src="' . $settings['images_url'] . '/' . $context['user']['language'] . '/new.gif" alt="' . $txt['new'] . '" border="0" /></a>', '</b></div><div style="font-size: 9px;">von ', $post['poster']['link'], ' in ', $post['board']['link'], ' </br> ', $post['time'], '

| Klicks: ', $post['views'], ' | Antworten: ', $post['replies'], '</font><hr>
</td>
</tr>';
echo '
</table></div>';