collapse

* Simple Portal Archived Forum

This is an Archive Forum.

The content in this forum may be out-of-date or have been superseded by newer information, and links in forum pages to other sites may not work.
This forum contains archives for future reference.

Visit our thread at Simple Machines Forum for current support.

SMF 2.1 users: EhPortal is a ported version of Simple Portal specifically designed for the SMF 2.1 branch.
Please visit web-develop.ca to download EhPortal and for its support.

* User Info

 
 
Welcome, Guest. Please login or register.

* Who's Online

  • Dot Guests: 380
  • Dot Hidden: 0
  • Dot Users: 0

There aren't any users online.

* Shoutbox

Refresh History
  • Shoutbox is not for support!
  • {OCS}MasterSeal: Yup, Still adore SP
    April 21, 2019, 07:08:06 PM
  • {OCS}MasterSeal: STILL love SP :)
    November 24, 2018, 05:05:50 AM
  • ♦ Ninja ZX-10RR ♦: <3 aegersz
    September 13, 2018, 03:36:09 PM
  • aegersz: I STILL <3 LOVE SimplePortal
    September 13, 2018, 07:11:39 AM
  • aegersz: o LOVE you guys - Simple Portal rocks !
    May 09, 2018, 05:18:59 AM
  • Chen Zhen: our apologies for the site being down.. please read server issues topic
    March 22, 2018, 05:32:38 AM
  • {OCS}MasterSeal: LOL PLEASE forget I just posted that. I found the answer in my own dang post back in 2015. lol sorry!
    July 04, 2017, 10:47:55 PM
  • {OCS}MasterSeal: I know this SB isnt' for support, but I just have a general question. Who would I contact to find out where SP stores its block info? Is it DB driven or files? I searched the site but came up with nothing. probably my fault any insight is appreciated.
    July 04, 2017, 10:43:36 PM
  • ♦ Ninja ZX-10RR ♦: Excuse me but what does Simpleportal have to deal with that?
    February 05, 2017, 08:21:14 PM
  • WhiteEagle: of course IMHO that site appears to be dead :(
    February 04, 2017, 01:08:05 PM
  • WhiteEagle: If I can get that, then I'll use it for that site...
    February 04, 2017, 01:07:35 PM
  • WhiteEagle: decided to not use SMF for any projects, unless I can get a copy of the premium version of the fanfiction archive plugin
    February 04, 2017, 01:06:54 PM
  • expertdecisions: cloudflare
    January 28, 2017, 08:01:47 AM
  • aegersz: SM release 2.0.13 !
    January 12, 2017, 06:00:13 AM
  • raffo: Tks Emanuele, even if I didn't understand the fix :D
    November 07, 2016, 02:01:20 AM
  • emanuele: [link]
    November 01, 2016, 12:43:50 PM
  • emanuele: raffo: the English support board is a good place. ;)
    November 01, 2016, 12:43:38 PM
  • raffo: Where can I find the fix for the shoutbox?
    November 01, 2016, 05:06:09 AM
  • {OCS}MasterSeal: To the SP team, I make a point to come here and thank you as much as possible for your work.  so again, THANK YOU!
    October 28, 2016, 10:38:05 AM
  • emanuele: That's indeed funny, the limit is present only in the patch and not the full install.
    October 22, 2016, 06:14:58 PM

* Recent Posts

Adding Forums Button to Nav bar by jirapon
[August 01, 2019, 09:07:12 AM]


Re: Board Icons by ♦ Ninja ZX-10RR ♦
[July 30, 2019, 04:03:41 PM]


MOVED: Czech translation???? by ♦ Ninja ZX-10RR ♦
[July 30, 2019, 03:04:51 PM]


Board Icons by jirapon
[July 30, 2019, 07:28:44 AM]


Re: Thankyou Simpleportal, by ♦ Ninja ZX-10RR ♦
[July 29, 2019, 09:41:29 AM]

Welcome to SimplePortal.net! You can download SimplePortal from the Downloads Area!

Author Topic: [Block] Recent Topics/Posts with Post Preview!  (Read 178362 times)

0 Members and 2 Guests are viewing this topic.

Offline Old Fossil

  • Beta Tester
  • *
  • Posts: 796
  • Gender: Male
  • SMF Version: 2.0.4
  • SP Version: 2.3.5
Re: [Block] Recent Topics/Posts with Post Preview!
« Reply #140 on: May 04, 2013, 11:03:58 AM »
Excellent stuff Blue.

 :)

Looking forward to the next one already.
Daily backups mean less headaches

Block Set Up

I may be no coding expert but I am willing to help where I can.

I eat Spammers for breakfast

Offline Vaughn

  • Semi Newbie
  • *
  • Posts: 8
  • SMF Version: 2 RC3
  • SP Version: 2.3.2
Re: [Block] Recent Topics/Posts with Post Preview!
« Reply #141 on: July 06, 2013, 05:52:43 AM »
Excellent mod. Couple of questions (couldn't find any answers).

Can you get it to show emoticons instead of the text?
Can you get it to show Youtube vids instead of the link?
Can you automatically remove the "..." at the end if the message is already less characters than the max limit?
Can you add a reply button? (and/or a quick reply box which appears when you click "reply"?)

Offline Old Fossil

  • Beta Tester
  • *
  • Posts: 796
  • Gender: Male
  • SMF Version: 2.0.4
  • SP Version: 2.3.5
Re: [Block] Recent Topics/Posts with Post Preview!
« Reply #142 on: July 06, 2013, 09:14:04 PM »
Quote
Can you get it to show emoticons instead of the text?
Can you get it to show Youtube vids instead of the link?

If you read back through the topic the smileys will be changed so they do appear.

As for youtube these would be better as link texts not as an actual screen.
Daily backups mean less headaches

Block Set Up

I may be no coding expert but I am willing to help where I can.

I eat Spammers for breakfast

Offline Blue

  • Customizer
  • *
  • Posts: 379
  • Gender: Male
  • Block Maker? =P
Re: [Block] Recent Topics/Posts with Post Preview!
« Reply #143 on: July 07, 2013, 08:33:22 AM »
Can you automatically remove the "..." at the end if the message is already less characters than the max limit?
Can you add a reply button? (and/or a quick reply box which appears when you click "reply"?)

The 2 first questions Old Fossil answered as I would :)

These last ones are possible and I'll post back when done :)
Please to keep this website running, if you like SimplePortal, make a
one-time subscription. Thank you for your support.

Offline Vaughn

  • Semi Newbie
  • *
  • Posts: 8
  • SMF Version: 2 RC3
  • SP Version: 2.3.2
Re: [Block] Recent Topics/Posts with Post Preview!
« Reply #144 on: July 07, 2013, 01:58:40 PM »
I think the option to toggle videos on/off in the settings would be pretty handy. I know some people would prefer links as the videos take up screen space, but personally I'd prefer the videos to show.

I understand if that's too tough to code though. Or if I'm the only person who'd prefer it the other way.

Offline Blue

  • Customizer
  • *
  • Posts: 379
  • Gender: Male
  • Block Maker? =P
Re: [Block] Recent Topics/Posts with Post Preview!
« Reply #145 on: July 07, 2013, 07:48:51 PM »
I understand what you are saying and I'll see what I can do to help you :)
Please to keep this website running, if you like SimplePortal, make a
one-time subscription. Thank you for your support.

Offline Old Fossil

  • Beta Tester
  • *
  • Posts: 796
  • Gender: Male
  • SMF Version: 2.0.4
  • SP Version: 2.3.5
Re: [Block] Recent Topics/Posts with Post Preview!
« Reply #146 on: July 07, 2013, 07:53:56 PM »
* Old Fossil is waiting.

Counting the years, months, weeks, days, hour, minutes and seconds.

 >:-D

Take ya time kiddo.
Daily backups mean less headaches

Block Set Up

I may be no coding expert but I am willing to help where I can.

I eat Spammers for breakfast

Offline kimyaci

  • Full Member
  • ***
  • Posts: 127
  • Gender: Male
    • Forumigo8navigation
  • SMF Version: 2.0.7
  • SP Version: 2.3.5
Re: [Block] Recent Topics/Posts with Post Preview!
« Reply #147 on: December 24, 2013, 02:20:19 PM »
Quote from: Blue


guest name in the message color looks normal.However, the guest name colors in the topics appear different .

SMF 2.0.7 HabboArtv1, Default Themes.

Offline Snoopix

  • Semi Newbie
  • *
  • Posts: 26
  • SMF Version: 2.0.2
  • SP Version: 2.3.5
Re: [Block] Recent Topics/Posts with Post Preview!
« Reply #148 on: December 29, 2013, 03:01:00 AM »
how install this mod? only need copy code on php block?

Offline Aquafan

  • Semi Newbie
  • *
  • Posts: 7
  • SMF Version: 2 RC1.2
  • SP Version: 2.3
Re: [Block] Recent Topics/Posts with Post Preview!
« Reply #149 on: December 29, 2013, 07:36:06 AM »
realy nice but stil dont have the smiley's couldn't find any answer

Offline Aquafan

  • Semi Newbie
  • *
  • Posts: 7
  • SMF Version: 2 RC1.2
  • SP Version: 2.3
Re: [Block] Recent Topics/Posts with Post Preview!
« Reply #150 on: January 05, 2014, 09:47:08 AM »
any one?  :'(

Offline kimyaci

  • Full Member
  • ***
  • Posts: 127
  • Gender: Male
    • Forumigo8navigation
  • SMF Version: 2.0.7
  • SP Version: 2.3.5
Re: [Block] Recent Topics/Posts with Post Preview!
« Reply #151 on: January 06, 2014, 09:24:09 AM »
1. Block:  do not to Active.
Code: [Select]
<?php

/*
Block: Recent posts with post preview
Author: Blue @ Simple Portal.net
Version: 1.5
*/

/* [SETUP WHAT YOU WANT HERE] */

$topics_posts 1;  // TOPICS - 1 | MESSAGES - 2
$limit 8;  // How many recent posts do you want to output?
$number 0;  // How many characters do you want to output?
$exclude_boards = array(318427426432425433424,423431434430,429,310);  // IF null guests can see all boards | IF you want to hide some boards use: array( ID1, ID2, ID3) where ID is the board's ID
$htmlspecialcharacters =true// Do you need to show html special characters like Greek characters?
$default_avatar 'http://img15.hostingpics.net/pics/282198defaultavatar.png';

// Scroll Enable? Height and Speed?
$scrolling 2;       // ENABLE - 1 | DISABLE - 2
$height "0px";
$speed 0;           // SLOW - 1 | MEDIUM - 10 | FAST - 20

// Do you want to translate it to your own language? :P
$text['sportal_false'] = 'Simple Portal not found';
$text['board'] = '';
$text['who'] = '';

/* [STOP!] - THIS IS THE END OF SETUP */

//Only code from now on ;)
global $smcFunc$scripturl$sourcedir$modSettings$user_info$settings$context;

// Lets see if you are using Simple Portal. If not...well...go get them :D
if (!file_exists($sourcedir '/PortalBlocks.php'))
{
 echo $text['sportal_false'];
 return;
}

// Let's grab some database results
if ($topics_posts == 1) {

 if (is_array($exclude_boards) || (int) $exclude_boards === $exclude_boards)
 {
 $exclude_boards is_array($exclude_boards) ? $exclude_boards : array($exclude_boards);
 }
 elseif ($exclude_boards != null)
 {
 $output_method $exclude_boards;
 $exclude_boards = array();
 }

$posts_result $smcFunc['db_query']('''
      SELECT m.poster_name, m.poster_time, m.id_msg, m.id_member, m.subject, m.body, m.id_topic, b.name, t.id_last_msg, u.avatar, g.online_color,' 
. ($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'
) . '
   FROM {db_prefix}topics AS t
   LEFT JOIN {db_prefix}boards AS b ON (t.id_board = b.id_board)
   LEFT JOIN {db_prefix}messages AS m ON (m.id_msg = t.id_last_msg)
   LEFT JOIN {db_prefix}members AS u ON (m.id_member = u.id_member)
   LEFT JOIN {db_prefix}membergroups AS g ON (g.id_group = CASE WHEN u.id_group = 0 THEN u.id_post_group ELSE u.id_group END)
   ' 
. (!$user_info['is_guest'] ? '
 LEFT JOIN {db_prefix}log_topics AS lt ON (lt.id_topic = m.id_topic AND lt.id_member = ' 
$user_info['id'] . ')
 LEFT JOIN {db_prefix}log_mark_read AS lmr ON (lmr.id_board = b.id_board AND lmr.id_member = ' 
$user_info['id'] . ')' '') . '     
   WHERE m.approved=1'   
. (empty($exclude_boards) ? '' '
 AND b.id_board NOT IN ({array_int:exclude_boards})'
) . ' AND {query_see_board}
   ORDER BY t.id_last_msg DESC
   LIMIT ' 
$limit
 array(
 'exclude_boards' => empty($exclude_boards) ? '' $exclude_boards,
 )   
   );
$posts = array();
while (
$row_posts $smcFunc['db_fetch_assoc']($posts_result))
{

      global 
$memberContext;
      
loadMemberData($row_posts['id_member_updated']);
      
loadMemberContext($row_posts['id_member_updated']);

   
$posts[] = array(
   'id' => $row_posts['id_member_updated'],
      
'username' => '<a style="color: ' $row_posts['online_color'] . ';" href="' $scripturl '?action=profile;u=' $row_posts['id_member'] . '">' $row_posts['poster_name'] . '</a>',
      
'subject' => '<a style="font-weight: bold;" title="' $text['board'] . ' ' $row_posts['name'] .'" href="' $scripturl '?topic=' $row_posts['id_topic'] . '.msg' $row_posts['id_last_msg'] . ';topicseen#new">' shorten_subject($row_posts['subject'], 25) . '</a>',
      
'body' => $row_posts['body'],
   'avatar' => $row_posts['avatar'] == '' $memberContext[$row_posts['id_member_updated']]['avatar']['href'] : (stristr($row_posts['avatar'], 'http://') ? $row_posts['avatar'] : $modSettings['avatar_url'] . '/' $row_posts['avatar']),
   'board' => $row_posts['name'], 
   'time' => timeformat($row_posts['poster_time']),
   'new' => !empty($row_posts['is_read'])
   );
}
$smcFunc['db_free_result']($posts_result);

} else {

 if (is_array($exclude_boards) || (int) $exclude_boards === $exclude_boards)
 {
 $exclude_boards is_array($exclude_boards) ? $exclude_boards : array($exclude_boards);
 }
 elseif ($exclude_boards != null)
 {
 $output_method $exclude_boards;
 $exclude_boards = array();
 }

$posts_result $smcFunc['db_query']('''
   SELECT m.poster_name, m.poster_time, m.id_msg, m.id_member, m.subject, m.body, m.id_topic, b.name, b.id_board, u.avatar, g.online_color,' 
. ($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'
) . '
   FROM {db_prefix}messages AS m
   LEFT JOIN {db_prefix}boards AS b ON (m.id_board = b.id_board)
   LEFT JOIN {db_prefix}members AS u ON (m.id_member = u.id_member)
   LEFT JOIN {db_prefix}membergroups AS g ON (g.id_group = CASE WHEN u.id_group = 0 THEN u.id_post_group ELSE u.id_group END)
   ' 
. (!$user_info['is_guest'] ? '
 LEFT JOIN {db_prefix}log_topics AS lt ON (lt.id_topic = m.id_topic AND lt.id_member = ' 
$user_info['id'] . ')
 LEFT JOIN {db_prefix}log_mark_read AS lmr ON (lmr.id_board = b.id_board AND lmr.id_member = ' 
$user_info['id'] . ')' '') . '   
   WHERE m.approved=1'   
. (empty($exclude_boards) ? '' '
 AND b.id_board NOT IN ({array_int:exclude_boards})'
) . ' AND {query_see_board}
   ORDER BY m.id_msg DESC
   LIMIT ' 
$limit
 array(
 'exclude_boards' => empty($exclude_boards) ? '' $exclude_boards,
 )   
   );
$posts = array();
while (
$row_posts $smcFunc['db_fetch_assoc']($posts_result))
{

      global 
$memberContext;
      
loadMemberData($row_posts['id_member']);
      
loadMemberContext($row_posts['id_member']);

   
$posts[] = array(
   'id' => $row_posts['id_member'],
      
'username' => '<a style="color: ' $row_posts['online_color'] . ';" href="' $scripturl '?action=profile;u=' $row_posts['id_member'] . '">' $row_posts['poster_name'] . '</a>',
      
'subject' => '<a style="font-weight: bold;" title="' $text['board'] . ' ' $row_posts['name'] .'" href="' $scripturl '?topic=' $row_posts['id_topic'] . '.msg' $row_posts['id_msg'] . ';topicseen#new">' shorten_subject($row_posts['subject'], 25) . '</a>',
      
'body' => $row_posts['body'],
    'avatar' => $row_posts['avatar'] == '' $memberContext[$row_posts['id_member']]['avatar']['href'] : (stristr($row_posts['avatar'], 'http://') ? $row_posts['avatar'] : $modSettings['avatar_url'] . '/' $row_posts['avatar']),
   'board' => $row_posts['name'],  
   'time' => timeformat($row_posts['poster_time']),
   'new' => !empty($row_posts['is_read'])
   );
}
$smcFunc['db_free_result']($posts_result);

}

//Finally the Output

//Scrolling xD
if ($scrolling == 1)
echo 

<div style="overflow: hidden;"><marquee height=' 
$height ' behavior="scroll" direction="up" scrollamount="' $speed '" onmouseover="this.stop()" onmouseout="this.start()">';

// Lets fix the BBCode bug and Strip the Text
 
$form_message preg_replace(array('~\n?\[quote.*?\].*\[/quote\]\n?~is''~^\n~''~\[/quote\]~'), ''$post['body']);
$content1 str_replace("[""<"$form_message);
$content2 str_replace("]"">"$content1); 
$content3 strip_tags($content2);
$preview strip_tags(substr (htmlspecialchars_decode($content3),0,$number));

echo '
 
<td><div class="cat_bar">
  <h3 class="catbg">

<table  border="0" cellpadding="0" cellspacing="0" width="100%" colspan="0">
<tr class="">
<td class="son_konular10"><span class="smalltext"><strong>Recent Topics</strong></span></td>
<td class="gonderen10"><span class="smalltext"><strong>Sender</strong></span></td>
<td class="tarih10"><span class="smalltext"><strong>Date</strong></span></td>
</tr></table></h3></div>'
;

echo
'
<span class="upperframe"><span></span></span>
<div class="roundframe">
<table  border="0" cellpadding="0" cellspacing="0" width="100%" colspan="0">'
;

foreach (
$posts as $post) {

echo
'
<tr>
<td class="son_konular10"><img src="'
$settings['images_url'], '/konubasi.gif" style="margin-right:3px;" alt="resim" border="0" />' .str_ireplace('Re: '''$post['subject']);

 if (!$post['new'] && $context['user']['is_logged'])
 echo '&nbsp;<img src="'$settings['images_url'], '/'$context['user']['language'], '/new.gif" alt="new" border="0" />';

echo
'
<hr />
</td>
<td class="gonderen10"><img src="'
$settings['images_url'], '/uyebasi.gif" style="margin-right:3px;" alt="resim" border="0" />' $post['username'] . '<hr /></td> ';

echo
'
 <td class="tarih10"><img src="'
$settings['images_url'], '/tarihbasi.gif" style="margin-right:3px;" alt="resim" border="0" /> ' $post['time'] .'<hr /></td></tr> ';
 }
echo
'

</table>
</div>
<span class="lowerframe"><span></span></span></td>'
;

//Scrolling xD
if ($scrolling == 1)
echo 
'</marquee></div>';
 ?>


2.Block; do not to Active.

Code: [Select]
<?php


/*
Block: 
Author: Blue @ Simple Portal.net
Version: 1.5
*/

/* [SETUP WHAT YOU WANT HERE] */

$topics_posts 2;  // TOPICS - 1 | MESSAGES - 2
$limit 8;  // 
$number 0;  // 
$exclude_boards = array(318427426432425433424,423431434430,429,310);  // IF null guests can see all boards | IF you want to hide some boards use: array( ID1, ID2, ID3) where ID is the board's ID
$htmlspecialcharacters =true//
$default_avatar 'http://img15.hostingpics.net/pics/282198defaultavatar.png';

// Scroll Enable? Height and Speed?
$scrolling 2;       // ENABLE - 1 | DISABLE - 2
$height "0px";
$speed 0;           // SLOW - 1 | MEDIUM - 10 | FAST - 20

// Do you want to translate it to your own language? :P
$text['sportal_false'] = 'Simple Portal not found';
$text['board'] = '';
$text['who'] = '';

/* [STOP!] - THIS IS THE END OF SETUP */

//Only code from now on ;)
global $smcFunc$scripturl$sourcedir$modSettings$user_info$settings$context;

// Lets see if you are using Simple Portal. If not...well...go get them :D
if (!file_exists($sourcedir '/PortalBlocks.php'))
{
 echo $text['sportal_false'];
 return;
}

// Let's grab some database results
if ($topics_posts == 1) {

 if (is_array($exclude_boards) || (int) $exclude_boards === $exclude_boards)
 {
 $exclude_boards is_array($exclude_boards) ? $exclude_boards : array($exclude_boards);
 }
 elseif ($exclude_boards != null)
 {
 $output_method $exclude_boards;
 $exclude_boards = array();
 }

$posts_result $smcFunc['db_query']('''
   SELECT m.poster_name, m.poster_time, m.id_msg, t.id_member_updated, m.subject, m.body, m.id_topic, b.name, t.id_last_msg, u.avatar, g.online_color,' 
. ($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'
) . '
   FROM {db_prefix}topics AS t
   LEFT JOIN {db_prefix}boards AS b ON (t.id_board = b.id_board)
   LEFT JOIN {db_prefix}messages AS m ON (m.id_msg = t.id_last_msg)
   LEFT JOIN {db_prefix}members AS u ON (t.id_member_updated = u.id_member)
   LEFT JOIN {db_prefix}membergroups AS g ON (g.id_group = CASE WHEN u.id_group = 0 THEN u.id_post_group ELSE u.id_group END)
   ' 
. (!$user_info['is_guest'] ? '
 LEFT JOIN {db_prefix}log_topics AS lt ON (lt.id_topic = m.id_topic AND lt.id_member = ' 
$user_info['id'] . ')
 LEFT JOIN {db_prefix}log_mark_read AS lmr ON (lmr.id_board = b.id_board AND lmr.id_member = ' 
$user_info['id'] . ')' '') . '     
   WHERE m.approved=1'   
. (empty($exclude_boards) ? '' '
 AND b.id_board NOT IN ({array_int:exclude_boards})'
) . ' AND {query_see_board}
   ORDER BY t.id_last_msg DESC
   LIMIT ' 
$limit
 array(
 'exclude_boards' => empty($exclude_boards) ? '' $exclude_boards,
 )   
   );
$posts = array();
while (
$row_posts $smcFunc['db_fetch_assoc']($posts_result))
{

      global 
$memberContext;
      
loadMemberData($row_posts['id_member_updated']);
      
loadMemberContext($row_posts['id_member_updated']);

   
$posts[] = array(
   'id' => $row_posts['id_member_updated'],
      
'username' => '<a style="color: ' $row_posts['online_color'] . ';" href="' $scripturl '?action=profile;u=' $row_posts['id_member_updated'] . '">' $row_posts['poster_name'] . '</a>',
      
'subject' => '<a style="font-weight: bold;" title="' $text['board'] . ' ' $row_posts['name'] .'" href="' $scripturl '?topic=' $row_posts['id_topic'] . '.msg' $row_posts['id_last_msg'] . ';topicseen#new">' shorten_subject($row_posts['subject'], 25) . '</a>',
      
'body' => $row_posts['body'],
   'avatar' => $row_posts['avatar'] == '' $memberContext[$row_posts['id_member_updated']]['avatar']['href'] : (stristr($row_posts['avatar'], 'http://') ? $row_posts['avatar'] : $modSettings['avatar_url'] . '/' $row_posts['avatar']),
   'board' => $row_posts['name'], 
   'time' => timeformat($row_posts['poster_time']),
   'new' => !empty($row_posts['is_read'])
   );
}
$smcFunc['db_free_result']($posts_result);

} else {

 if (is_array($exclude_boards) || (int) $exclude_boards === $exclude_boards)
 {
 $exclude_boards is_array($exclude_boards) ? $exclude_boards : array($exclude_boards);
 }
 elseif ($exclude_boards != null)
 {
 $output_method $exclude_boards;
 $exclude_boards = array();
 }

$posts_result $smcFunc['db_query']('''
   SELECT m.poster_name, m.poster_time, m.id_msg, m.id_member, m.subject, m.body, m.id_topic, b.name, b.id_board, u.avatar, g.online_color,' 
. ($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'
) . '
   FROM {db_prefix}messages AS m
   LEFT JOIN {db_prefix}boards AS b ON (m.id_board = b.id_board)
   LEFT JOIN {db_prefix}members AS u ON (m.id_member = u.id_member)
   LEFT JOIN {db_prefix}membergroups AS g ON (g.id_group = CASE WHEN u.id_group = 0 THEN u.id_post_group ELSE u.id_group END)
   ' 
. (!$user_info['is_guest'] ? '
 LEFT JOIN {db_prefix}log_topics AS lt ON (lt.id_topic = m.id_topic AND lt.id_member = ' 
$user_info['id'] . ')
 LEFT JOIN {db_prefix}log_mark_read AS lmr ON (lmr.id_board = b.id_board AND lmr.id_member = ' 
$user_info['id'] . ')' '') . '   
   WHERE m.approved=1'   
. (empty($exclude_boards) ? '' '
 AND b.id_board NOT IN ({array_int:exclude_boards})'
) . ' AND {query_see_board}
   ORDER BY m.id_msg DESC
   LIMIT ' 
$limit
 array(
 'exclude_boards' => empty($exclude_boards) ? '' $exclude_boards,
 )   
   );
$posts = array();
while (
$row_posts $smcFunc['db_fetch_assoc']($posts_result))
{

      global 
$memberContext;
      
loadMemberData($row_posts['id_member']);
      
loadMemberContext($row_posts['id_member']);

   
$posts[] = array(
   'id' => $row_posts['id_member'],
      
'username' => '<a style="color: ' $row_posts['online_color'] . ';" href="' $scripturl '?action=profile;u=' $row_posts['id_member'] . '">' $row_posts['poster_name'] . '</a>',
      
'subject' => '<a style="font-weight: bold;" title="' $text['board'] . ' ' $row_posts['name'] .'" href="' $scripturl '?topic=' $row_posts['id_topic'] . '.msg' $row_posts['id_msg'] . ';topicseen#new">' shorten_subject($row_posts['subject'], 25) . '</a>',
      
'body' => $row_posts['body'],
    'avatar' => $row_posts['avatar'] == '' $memberContext[$row_posts['id_member']]['avatar']['href'] : (stristr($row_posts['avatar'], 'http://') ? $row_posts['avatar'] : $modSettings['avatar_url'] . '/' $row_posts['avatar']),
   'board' => $row_posts['name'],  
   'time' => timeformat($row_posts['poster_time']),
   'new' => !empty($row_posts['is_read'])
   );
}
$smcFunc['db_free_result']($posts_result);

}

//Finally the Output

//Scrolling xD
if ($scrolling == 1)
echo 
'                                        <div style="overflow: hidden;"><marquee height=' $height ' behavior="scroll" direction="up" scrollamount="' $speed '" onmouseover="this.stop()" onmouseout="this.start()">';


// Lets fix the BBCode bug and Strip the Text
 
$form_message preg_replace(array('~\n?\[quote.*?\].*\[/quote\]\n?~is''~^\n~''~\[/quote\]~'), ''$post['body']);
$content1 str_replace("[""<"$form_message);
$content2 str_replace("]"">"$content1); 
$content3 strip_tags($content2);
$preview strip_tags(substr (htmlspecialchars_decode($content3),0,$number));

echo '
 
<td><div class="cat_bar">
  <h3 class="catbg">

<table  border="0" cellpadding="0" cellspacing="0" width="100%" colspan="0">
<tr class="">
<td class="son_konular10"><span class="smalltext"><strong>Recent Post</strong></span></td>
<td class="gonderen10"><span class="smalltext"><strong>Sender</strong></span></td>
<td class="tarih10"><span class="smalltext"><strong>Date</strong></span></td>
</tr></table></h3></div>'
;

echo
'
<span class="upperframe"><span></span></span>
<div class="roundframe">
<table  border="0" cellpadding="0" cellspacing="0" width="100%" colspan="0">'
;

foreach (
$posts as $post) {

echo
'
<tr>
<td class="son_konular10"><img src="'
$settings['images_url'], '/konubasi.gif" style="margin-right:3px;" alt="resim" border="0" />' .str_ireplace('Re: '''$post['subject']);

 if (!$post['new'] && $context['user']['is_logged'])
 echo '&nbsp;<img src="'$settings['images_url'], '/'$context['user']['language'], '/new.gif" alt="new" border="0" />';

echo
'
<hr />
</td>
<td class="gonderen10"><img src="'
$settings['images_url'], '/uyebasi.gif" style="margin-right:3px;" alt="resim" border="0" />' $post['username'] . '<hr /></td> ';

echo
'
 <td class="tarih10"><img src="'
$settings['images_url'], '/tarihbasi.gif" style="margin-right:3px;" alt="resim" border="0" /> ' $post['time'] .'<hr /></td></tr> ';
 }
echo
'
</table>
</div>
<span class="lowerframe"><span></span></span></td>'
;

//Scrolling xD
if ($scrolling == 1)
echo 
'</marquee></div>';
 ?>





SMF 2.0.7 HabboArtv1, Default Themes.

Offline kimyaci

  • Full Member
  • ***
  • Posts: 127
  • Gender: Male
    • Forumigo8navigation
  • SMF Version: 2.0.7
  • SP Version: 2.3.5
Re: [Block] Recent Topics/Posts with Post Preview!
« Reply #152 on: January 06, 2014, 09:24:46 AM »
3.Block:  Is activated.

Code: [Select]
$columns = 14; //
$block_ids = array(253); //

$block_data = array();
foreach ($block_ids as $block)
{
   $block_data[$block] = current(getBlockInfo(false, $block, false, false)); //
   $block_data[$block]['style'] = sportal_parse_style('explode', $block_data[$block]['style'], false); //
}

echo '
 <table border="0" cellpadding="1" cellspacing="0" width="100%" colspan="0">
<tr>';

echo '
<td><table style="width: 100%;">
   <tr>';

$counter = 0;
foreach ($block_data as $data)
{
   if ($counter != 0 && $counter % $columns == 0)
   {
      echo '
   </tr>
   <tr>';
   }

   echo '
      <td style="width: ', ceil((10 / $columns)), '%; vertical-align: top;">
         ', template_block($data), '
      </td>';

   $counter++;
}

echo '
   </tr>
</table></td>';






$columns = 14; //
$block_ids = array(252); //

$block_data = array();
foreach ($block_ids as $block)
{
   $block_data[$block] = current(getBlockInfo(false, $block, false, false)); //
   $block_data[$block]['style'] = sportal_parse_style('explode', $block_data[$block]['style'], false); //
}


echo '
   <td><table style="width: 100%;">
   <tr>';

$counter = 0;
foreach ($block_data as $data)
{
   if ($counter != 0 && $counter % $columns == 0)
   {
      echo '
   </tr>
   <tr>';
   }

   echo '
      <td style="width: ', ceil((10 / $columns)), '%; vertical-align: top;">
         ', template_block($data), '
      </td>';

   $counter++;
}

echo '
   </tr>
</table></td>';

echo '
</tr>
</table>';

Add to your index.css file;
Code: [Select]
.son_konular10{
width: 57%;
text-align: left;
padding: 0px 8px;
cellspacing: 5;
cellpadding: 0;
class: bordercolor;
}
.gonderen10{
width: 17%;
text-align: left;

}
.tarih10{
width: 26%;
text-align: left;
}
SMF 2.0.7 HabboArtv1, Default Themes.

Offline [SiNaN]

  • Mr. SimplePortal
  • Developer
  • *
  • Posts: 6782
  • SMF Version: 2.0.15
  • SP Version: 2.3.7
Re: [Block] Recent Topics/Posts with Post Preview!
« Reply #153 on: January 06, 2014, 12:57:05 PM »
realy nice but stil dont have the smiley's couldn't find any answer

Code: (Find) [Select]
$preview = substr ($content3,0,$number);
Code: (Replace) [Select]
$preview = substr ($content3,0,$number);
parsesmileys($preview);
And slowly, you come to realize... It's all as it should be...

Offline Aquafan

  • Semi Newbie
  • *
  • Posts: 7
  • SMF Version: 2 RC1.2
  • SP Version: 2.3
Re: [Block] Recent Topics/Posts with Post Preview!
« Reply #154 on: January 14, 2014, 12:00:36 PM »
Thank you so mucht that did it   :applause:

Offline Petter

  • Jr. Member
  • **
  • Posts: 53
  • SMF Version: 2 RC2
  • SP Version: 2.3.1
Re: [Block] Recent Topics/Posts with Post Preview!
« Reply #155 on: February 09, 2014, 05:17:57 AM »
Is there a file that needs to be istalled in the package manager to make this work?
Just creating a php block with the code gives me the error:
Quote
Parse error: syntax error, unexpected T_VARIABLE in /home/d/dev/www/Sources/PortalBlocks.php(3561) : eval()'d code on line 18

Offline AngelinaBelle

  • Comrade
  • *
  • Posts: 4870
  • Gender: Female
  • SMF Version: 2 RC3
  • SP Version: 2.3.2
Re: [Block] Recent Topics/Posts with Post Preview!
« Reply #156 on: February 09, 2014, 04:09:37 PM »
That error message tells you that, on line 18 of what you have pasted into your php block, there is a php error -- unexpected variable.

It does not tell you WHICH block is causing the problem -- there are 3 blocks involved here.

To test this, start by deactivating all 3 blocks.
Then activate block 1 to see if you get the error.
Then turn that one off and test block 2 the same way.
If the error is not in block 1 or block 2, then perhaps it is in block 3 itself (the one which references the other 2 blocks).

In this way, you can begin to narrow down the error to which line is causing the problem.
Please to keep this website running, if you like SimplePortal, make a
one-time subscription. Thank you for your support.

Have you tried the SimplePortal documentation?

Offline Petter

  • Jr. Member
  • **
  • Posts: 53
  • SMF Version: 2 RC2
  • SP Version: 2.3.1
Re: [Block] Recent Topics/Posts with Post Preview!
« Reply #157 on: February 10, 2014, 02:50:51 AM »
there are 3 blocks involved here.



I really must have got things wrong here...  :-[
What 3 blocks?
I thought I was supposed to create one php-block and past the code?


Offline AngelinaBelle

  • Comrade
  • *
  • Posts: 4870
  • Gender: Female
  • SMF Version: 2 RC3
  • SP Version: 2.3.2
Re: [Block] Recent Topics/Posts with Post Preview!
« Reply #158 on: February 10, 2014, 02:39:50 PM »
There are three different blocks given.  They are numbered 1, 2, and 3.
2 of them are kept inactive.
The third block,, the active one, displays the other two block contents within itself.
Please to keep this website running, if you like SimplePortal, make a
one-time subscription. Thank you for your support.

Have you tried the SimplePortal documentation?

Offline Tarista

  • Semi Newbie
  • *
  • Posts: 37
  • SMF Version: 2.0.10
  • SP Version: 2.3.5
Re: [Block] Recent Topics/Posts with Post Preview!
« Reply #159 on: February 25, 2014, 09:28:30 AM »
This block seems like it adds 10 queries or so to my page, is that possible to avoid? If I use it twice with limit 5 to each, so I can display both Posts/topics Messages/post it seems to add the double. It seems there is one or two queries per post?  If i inactivate it the queries drop down again.


Edit:
It seems to be this part that adds all the queries.

Code: [Select]
      global $memberContext;
      loadMemberData($row_posts['id_member']);
      loadMemberContext($row_posts['id_member']);
« Last Edit: February 25, 2014, 10:02:43 AM by Tarista »