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: 426
  • 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: Creating a Panels Tab in a Custom PHP Block Completed  (Read 89537 times)

0 Members and 2 Guests are viewing this topic.

Offline Blue

  • Customizer
  • *
  • Posts: 379
  • Gender: Male
  • Block Maker? =P
Re: Creating a Panels Tab in a Custom PHP Block Completed
« Reply #20 on: July 05, 2011, 04:16:05 PM »
Ok.. when I made the block I thought that this first tab would show all posts and the second tab would show only some boards so $excluded_boards only works in the second tab.

If you want to exclude boards from the first tab you have too find:
Code: [Select]
$what = ssi_recentTopics('25',NULL,'array');
And replace to:
Code: [Select]
$what = ssi_recentTopics('25',array(ID1,ID2),'array');
Where ID1 and ID2 are the IDs of the boards you want to exclude. Using that could it should be:
Code: [Select]
$what = ssi_recentTopics('25',array(8,37),'array');
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: 61
  • SMF Version: 2 RC5
  • SP Version: 2.3.3
Re: Creating a Panels Tab in a Custom PHP Block Completed
« Reply #21 on: July 05, 2011, 04:19:48 PM »
This is gonna sound gay but I have to say it -- I love you man! It works like a charm... I honestly don't know how I'm ever gonna repay you bud.... You just are filled with awesome-ness  :thumbsup:
« Last Edit: July 05, 2011, 04:22:01 PM by agent47 »

Offline Blue

  • Customizer
  • *
  • Posts: 379
  • Gender: Male
  • Block Maker? =P
Re: Creating a Panels Tab in a Custom PHP Block Completed
« Reply #22 on: July 05, 2011, 04:25:11 PM »
I'm glad I helped ;)
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: 61
  • SMF Version: 2 RC5
  • SP Version: 2.3.3
Re: Creating a Panels Tab in a Custom PHP Block Completed
« Reply #23 on: July 05, 2011, 04:37:44 PM »
Minor glitch again bro.
You're right first tab is gonna display topics from all boards and second, third, fourth and so on........... are supposed to display topics from a particular board.... So here's what I did:

First tab is this line:
Code: [Select]
$what = ssi_recentTopics('25',NULL,'array');
And second tab is this line:
Code: [Select]
$what = ssi_recentTopics('25',array(2,30,4,3,5,24,39,40,42,43,45,41,6,46,47,48,49,34,50,51,33,35,52,25,32,36,17,8,11,10,9,12,15,14,13,20,37,31,29,38,16,19,27),'array');
First tab displays all topics like it's supposed to but second tab displays only 2 topics from the particular board (which has it's ID excluded from the above line of code but it only displays 2 topics from that board whereas it's supposed to display 25 topics) ?
« Last Edit: July 05, 2011, 04:40:06 PM by agent47 »

Offline Blue

  • Customizer
  • *
  • Posts: 379
  • Gender: Male
  • Block Maker? =P
Re: Creating a Panels Tab in a Custom PHP Block Completed
« Reply #24 on: July 05, 2011, 05:14:56 PM »
Hum.. In my test server works great. Are your posts approved in the board that you want to include? This is a stupid question but are there more than 2 posts in that board? :angel:
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: 61
  • SMF Version: 2 RC5
  • SP Version: 2.3.3
Re: Creating a Panels Tab in a Custom PHP Block Completed
« Reply #25 on: July 05, 2011, 05:17:12 PM »
Yes and Yes.... Let me post my entire code how it looks in the block

Code: [Select]
<?php

/* [SETUP OF THE EXCLUDE BOARDS] */
$excluded_boards NULL;         // For the second tab -> If you want to hide some boards just add the IDs like $excluded_boards = '1,2,3'; 



// CODE FROM NOW ON
echo '
<script src="http://www.superheroalliance.net/SpryAssets/SpryTabbedPanels.js" type="text/javascript"></script> 
<link href="http://www.superheroalliance.net/SpryAssets/SpryTabbedPanels.css" rel="stylesheet" type="text/css" />
 
<div id="TabbedPanels1" class="TabbedPanels">
<ul class="TabbedPanelsTabGroup"> 
<li class="TabbedPanelsTab" tabindex="0">All Boards</li> 
<li class="TabbedPanelsTab" tabindex="0">Comics Discussion</li>
                <li class="TabbedPanelsTab" tabindex="0">TV, Movies & Music</li> 
</ul> 
<div class="TabbedPanelsContentGroup"> 
<div class="TabbedPanelsContent">'
;

// START OF FIRST TAB
global $scripturl$settings$context$txt;

        
$what ssi_recentTopics('25',NULL,'array');

echo '
<div class="tabsmenucontent" style="padding: 2px">
<table border="0" width="100%" cellspacing="1" cellpadding="2" class="bordercolor">
<tr class="titlebg">
                                <td valign="middle">Topic</td>
<td valign="middle">Poster</td>
<td valign="middle">Time</td>
<td valign="middle"></td>
</tr>'
;

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['time'], '#new"><img src="'$settings['images_url'], '/'$context['user']['language'], '/new.gif" alt="new" border="0" /></a>';

echo '
</td>
<td class="windowbg2" valign="middle">'
$topic['poster']['link'], '</td>
<td class="windowbg2" valign="middle">'
$topic['time'], '</td>
<td class="windowbg2" valign="middle">'
;

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="Last Post" title="Last Post" border="0" style="float: right;" /></a>';
}

echo 
'
</td>
</tr>
</table>
</div>'
;
// END OF FIRST TAB

echo'</div> 
<div class="TabbedPanelsContent">'
;

// START OF SECOND TAB
global $scripturl$settings$context$txt;
   
 $what ssi_recentTopics('25',array(2,30,4,3,5,24,39,40,42,43,45,41,6,46,47,48,49,34,50,51,33,35,52,25,32,36,17,8,11,10,9,12,15,14,13,20,37,31,29,38,16,19,27),'array');

echo '
<div class="tabsmenucontent" style="padding: 2px">
<table border="0" width="100%" cellspacing="1" cellpadding="2" class="bordercolor">
<tr class="titlebg">
                                <td valign="middle">Topic</td>
<td valign="middle">Poster</td>
<td valign="middle">Time</td>
<td valign="middle"></td>
</tr>'
;

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['time'], '#new"><img src="'$settings['images_url'], '/'$context['user']['language'], '/new.gif" alt="new" border="0" /></a>';

echo '
</td>
<td class="windowbg2" valign="middle">'
$topic['poster']['link'], '</td>
<td class="windowbg2" valign="middle">'
$topic['time'], '</td>
<td class="windowbg2" valign="middle">'
;

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="Last Post" title="Last Post" border="0" style="float: right;" /></a>';
}

echo 
'
</td>
</tr>
</table>
</div>'
;
// END OF SECOND TAB

echo'</div> 
</div> 
</div>
 
<script type="text/javascript"> 
<!-- 
var TabbedPanels1 = new Spry.Widget.TabbedPanels("TabbedPanels1"); 
Spry.Widget.TabbedPanels("TabbedPanels2");
//--> 
</script>
'
;


?>

Offline Blue

  • Customizer
  • *
  • Posts: 379
  • Gender: Male
  • Block Maker? =P
Re: Creating a Panels Tab in a Custom PHP Block Completed
« Reply #26 on: July 05, 2011, 05:45:46 PM »
Everything seems fine.

Try with a different board to see if it happens the same
« Last Edit: July 05, 2011, 05:57:09 PM by Blue »
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: 61
  • SMF Version: 2 RC5
  • SP Version: 2.3.3
Re: Creating a Panels Tab in a Custom PHP Block Completed
« Reply #27 on: July 05, 2011, 06:00:00 PM »
Same issue :'(
Tried a different board and it's displaying only 4 topics from that board. Wonder what's causing this.....

Offline Blue

  • Customizer
  • *
  • Posts: 379
  • Gender: Male
  • Block Maker? =P
Re: Creating a Panels Tab in a Custom PHP Block Completed
« Reply #28 on: July 05, 2011, 06:09:22 PM »
There seems to be a problem with ssi_recentTopics() hum.... try this:

Code: [Select]
<?php
// CODE FROM NOW ON
echo '
<script src="http://www.superheroalliance.net/SpryAssets/SpryTabbedPanels.js" type="text/javascript"></script> 
<link href="http://www.superheroalliance.net/SpryAssets/SpryTabbedPanels.css" rel="stylesheet" type="text/css" />
 
<div id="TabbedPanels1" class="TabbedPanels">
<ul class="TabbedPanelsTabGroup"> 
<li class="TabbedPanelsTab" tabindex="0">All Boards</li> 
<li class="TabbedPanelsTab" tabindex="0">Comics Discussion</li>
                <li class="TabbedPanelsTab" tabindex="0">TV, Movies & Music</li> 
</ul> 
<div class="TabbedPanelsContentGroup"> 
<div class="TabbedPanelsContent">'
;

// START OF FIRST TAB
global $scripturl$settings$context$txt;

        
$what ssi_recentTopics('25',NULL,'array');

echo '
<div class="tabsmenucontent" style="padding: 2px">
<table border="0" width="100%" cellspacing="1" cellpadding="2" class="bordercolor">
<tr class="titlebg">
                                <td valign="middle">Topic</td>
<td valign="middle">Poster</td>
<td valign="middle">Time</td>
<td valign="middle"></td>
</tr>'
;

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['time'], '#new"><img src="'$settings['images_url'], '/'$context['user']['language'], '/new.gif" alt="new" border="0" /></a>';

echo '
</td>
<td class="windowbg2" valign="middle">'
$topic['poster']['link'], '</td>
<td class="windowbg2" valign="middle">'
$topic['time'], '</td>
<td class="windowbg2" valign="middle">'
;

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="Last Post" title="Last Post" border="0" style="float: right;" /></a>';
}

echo 
'
</td>
</tr>
</table>
</div>'
;
// END OF FIRST TAB

echo'</div> 
<div class="TabbedPanelsContent">'
;

// START OF SECOND TAB
global $scripturl$settings$context$txt;
   
 $what2 ssi_recentTopics('25',NULL,array(28),'array');

echo '
<div class="tabsmenucontent" style="padding: 2px">
<table border="0" width="100%" cellspacing="1" cellpadding="2" class="bordercolor">
<tr class="titlebg">
                                <td valign="middle">Topic</td>
<td valign="middle">Poster</td>
<td valign="middle">Time</td>
<td valign="middle"></td>
</tr>'
;

foreach ($what2 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['time'], '#new"><img src="'$settings['images_url'], '/'$context['user']['language'], '/new.gif" alt="new" border="0" /></a>';

echo '
</td>
<td class="windowbg2" valign="middle">'
$topic['poster']['link'], '</td>
<td class="windowbg2" valign="middle">'
$topic['time'], '</td>
<td class="windowbg2" valign="middle">'
;

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="Last Post" title="Last Post" border="0" style="float: right;" /></a>';
}

echo 
'
</td>
</tr>
</table>
</div>'
;
// END OF SECOND TAB

echo'</div> 
</div> 
</div>
 
<script type="text/javascript"> 
<!-- 
var TabbedPanels1 = new Spry.Widget.TabbedPanels("TabbedPanels1"); 
Spry.Widget.TabbedPanels("TabbedPanels2");
//--> 
</script>
'
;


?>
« Last Edit: July 05, 2011, 06:14:28 PM by Blue »
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: 61
  • SMF Version: 2 RC5
  • SP Version: 2.3.3
Re: Creating a Panels Tab in a Custom PHP Block Completed
« Reply #29 on: July 05, 2011, 06:13:52 PM »
Same issue...... :(
You're right though, there seems to be some issue with the code because I applied this with my other java tab and the result is the same as we are facing with this.
« Last Edit: July 05, 2011, 06:16:31 PM by agent47 »

Offline Blue

  • Customizer
  • *
  • Posts: 379
  • Gender: Male
  • Block Maker? =P
Re: Creating a Panels Tab in a Custom PHP Block Completed
« Reply #30 on: July 05, 2011, 08:58:57 PM »
Ok, I've tried to simulate this problem in my test server but everything is working fine.

Let's try something different. The RecentTopics block that comes in Simple Portal works the same way that this block. So, try to put only the ID of the board that you want to show and limit it to 25 just like in this block. If even then the issue persists in the built-in Simple Portal block then I will have to make the query myself since something is going on with your ssi file.
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: 61
  • SMF Version: 2 RC5
  • SP Version: 2.3.3
Re: Creating a Panels Tab in a Custom PHP Block Completed
« Reply #31 on: July 06, 2011, 12:43:12 AM »
Could you be a lil more specific about what you want me to do bud?
I checked my error log and here's what it says under critical errors:
Quote
http://www.superheroalliance.net/index.php?action=admin;area=portalblocks;sa=edit
Wrong value type sent to the database. Array of integers expected. (exclude_boards)
Function: ssi_recentTopicsFile: /home/superher/public_html/SSI.php
Line: 469

I even tried using exclude_boards instead of excluded_boards, doesn't seem to work either.
« Last Edit: July 06, 2011, 01:48:30 AM by agent47 »

Offline Blue

  • Customizer
  • *
  • Posts: 379
  • Gender: Male
  • Block Maker? =P
Re: Creating a Panels Tab in a Custom PHP Block Completed
« Reply #32 on: July 06, 2011, 09:41:04 AM »
Now I corrected the critical erros (maybe that's the solution):

Let's see. If not I will have to do the query myself or beg for help to SP team :P

Code: [Select]
<?php
// CODE FROM NOW ON
echo '
<script src="http://www.superheroalliance.net/SpryAssets/SpryTabbedPanels.js" type="text/javascript"></script> 
<link href="http://www.superheroalliance.net/SpryAssets/SpryTabbedPanels.css" rel="stylesheet" type="text/css" />
 
<div id="TabbedPanels1" class="TabbedPanels">
<ul class="TabbedPanelsTabGroup"> 
<li class="TabbedPanelsTab" tabindex="0">All Boards</li> 
<li class="TabbedPanelsTab" tabindex="0">Comics Discussion</li>
                <li class="TabbedPanelsTab" tabindex="0">TV, Movies & Music</li> 
</ul> 
<div class="TabbedPanelsContentGroup"> 
<div class="TabbedPanelsContent">'
;

// START OF FIRST TAB
global $scripturl$settings$context$txt;

        
$what ssi_recentTopics(25nullnull'array');

echo '
<div class="tabsmenucontent" style="padding: 2px">
<table border="0" width="100%" cellspacing="1" cellpadding="2" class="bordercolor">
<tr class="titlebg">
                                <td valign="middle">Topic</td>
<td valign="middle">Poster</td>
<td valign="middle">Time</td>
<td valign="middle"></td>
</tr>'
;

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['time'], '#new"><img src="'$settings['images_url'], '/'$context['user']['language'], '/new.gif" alt="new" border="0" /></a>';

echo '
</td>
<td class="windowbg2" valign="middle">'
$topic['poster']['link'], '</td>
<td class="windowbg2" valign="middle">'
$topic['time'], '</td>
<td class="windowbg2" valign="middle">'
;

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="Last Post" title="Last Post" border="0" style="float: right;" /></a>';
}

echo 
'
</td>
</tr>
</table>
</div>'
;
// END OF FIRST TAB

echo'</div> 
<div class="TabbedPanelsContent">'
;

// START OF SECOND TAB
global $scripturl$settings$context$txt;
   
 $what2 ssi_recentTopics(25null, array(28), 'array');

echo '
<div class="tabsmenucontent" style="padding: 2px">
<table border="0" width="100%" cellspacing="1" cellpadding="2" class="bordercolor">
<tr class="titlebg">
                                <td valign="middle">Topic</td>
<td valign="middle">Poster</td>
<td valign="middle">Time</td>
<td valign="middle"></td>
</tr>'
;

foreach ($what2 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['time'], '#new"><img src="'$settings['images_url'], '/'$context['user']['language'], '/new.gif" alt="new" border="0" /></a>';

echo '
</td>
<td class="windowbg2" valign="middle">'
$topic['poster']['link'], '</td>
<td class="windowbg2" valign="middle">'
$topic['time'], '</td>
<td class="windowbg2" valign="middle">'
;

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="Last Post" title="Last Post" border="0" style="float: right;" /></a>';
}

echo 
'
</td>
</tr>
</table>
</div>'
;
// END OF SECOND TAB

echo'</div> 
</div> 
</div>
 
<script type="text/javascript"> 
<!-- 
var TabbedPanels1 = new Spry.Widget.TabbedPanels("TabbedPanels1"); 
Spry.Widget.TabbedPanels("TabbedPanels2");
//--> 
</script>
'
;


?>
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: 61
  • SMF Version: 2 RC5
  • SP Version: 2.3.3
Re: Creating a Panels Tab in a Custom PHP Block Completed
« Reply #33 on: July 06, 2011, 10:42:12 AM »
Same issue, sir :'(
How come there doesn't seem to be any errors while running this script on my test forum ? :/

Offline Blue

  • Customizer
  • *
  • Posts: 379
  • Gender: Male
  • Block Maker? =P
Re: Creating a Panels Tab in a Custom PHP Block Completed
« Reply #34 on: July 06, 2011, 11:02:37 AM »
In your official forum the block does not work right but in your test forum it does?

If that's the case then your ssi file has some problem and in order to work I'll have to do the query myself.
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: 61
  • SMF Version: 2 RC5
  • SP Version: 2.3.3
Re: Creating a Panels Tab in a Custom PHP Block Completed
« Reply #35 on: July 06, 2011, 11:59:29 AM »
Actually, yes. It seems to be working perfectly fine on my test forum
How would my SSI.php file have got messed in the first place?
« Last Edit: July 06, 2011, 12:08:08 PM by agent47 »

Offline Blue

  • Customizer
  • *
  • Posts: 379
  • Gender: Male
  • Block Maker? =P
Re: Creating a Panels Tab in a Custom PHP Block Completed
« Reply #36 on: July 06, 2011, 12:54:41 PM »
Maybe some modification changed it. Can you show me the funtion ssi_recentTopics from the SSI.php file to see if something is different?
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: 61
  • SMF Version: 2 RC5
  • SP Version: 2.3.3
Re: Creating a Panels Tab in a Custom PHP Block Completed
« Reply #37 on: July 06, 2011, 02:00:02 PM »
Here you go bud:

Code: [Select]
// Recent topic list:   [board] Subject by Poster Date
function ssi_recentTopics($num_recent = 8, $exclude_boards = null, $include_boards = null, $output_method = 'echo')
{
global $context, $settings, $scripturl, $txt, $db_prefix, $user_info;
global $modSettings, $smcFunc;

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() : (is_array($exclude_boards) ? $exclude_boards : array($exclude_boards));

// Only some boards?.
if (is_array($include_boards) || (int) $include_boards === $include_boards)
{
$include_boards = is_array($include_boards) ? $include_boards : array($include_boards);
}
elseif ($include_boards != null)
{
$output_method = $include_boards;
$include_boards = array();
}

$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']('substring', '
SELECT
m.poster_time, ms.subject, m.id_topic, m.id_member, m.id_msg, b.id_board, b.name AS board_name, t.num_replies, t.num_views,
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') . ', SUBSTRING(m.body, 1, 384) AS body, m.smileys_enabled, m.icon
FROM {db_prefix}topics AS t
INNER JOIN {db_prefix}messages AS m ON (m.id_msg = t.id_last_msg)
INNER JOIN {db_prefix}boards AS b ON (b.id_board = t.id_board)
INNER JOIN {db_prefix}messages AS ms ON (ms.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:current_member})
LEFT JOIN {db_prefix}log_mark_read AS lmr ON (lmr.id_board = b.id_board AND lmr.id_member = {int:current_member})' : '') . '
WHERE t.id_last_msg >= {int:min_message_id}
' . (empty($exclude_boards) ? '' : '
AND b.id_board NOT IN ({array_int:exclude_boards})') . '
' . (empty($include_boards) ? '' : '
AND b.id_board IN ({array_int:include_boards})') . '
AND {query_wanna_see_board}' . ($modSettings['postmod_active'] ? '
AND t.approved = {int:is_approved}
AND m.approved = {int:is_approved}' : '') . '
ORDER BY t.id_last_msg DESC
LIMIT ' . $num_recent,
array(
'current_member' => $user_info['id'],
'include_boards' => empty($include_boards) ? '' : $include_boards,
'exclude_boards' => empty($exclude_boards) ? '' : $exclude_boards,
'min_message_id' => $modSettings['maxMsgID'] - 35 * min($num_recent, 5),
'is_approved' => 1,
)
);
$posts = 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.
censorText($row['subject']);
censorText($row['body']);

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['board_name'],
'href' => $scripturl . '?board=' . $row['id_board'] . '.0',
'link' => '<a href="' . $scripturl . '?board=' . $row['id_board'] . '.0">' . $row['board_name'] . '</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'],
'replies' => $row['num_replies'],
'views' => $row['num_views'],
'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" rel="nofollow">' . $row['subject'] . '</a>',
// Retained for compatibility - is technically incorrect!
'new' => !empty($row['is_read']),
'is_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'] . '" />',
);
}
$smcFunc['db_free_result']($request);

// Just return it.
if ($output_method != 'echo' || empty($posts))
return $posts;

echo '
<table border="0" class="ssi_table">';
foreach ($posts as $post)
echo '
<tr>
<td align="right" valign="top" nowrap="nowrap">
[', $post['board']['link'], ']
</td>
<td valign="top">
<a href="', $post['href'], '">', $post['subject'], '</a>
', $txt['by'], ' ', $post['poster']['link'], '
', !$post['is_new'] ? '' : '<a href="' . $scripturl . '?topic=' . $post['topic'] . '.msg' . $post['new_from'] . ';topicseen#new" rel="nofollow"><img src="' . $settings['lang_images_url'] . '/new.gif" alt="' . $txt['new'] . '" /></a>', '
</td>
<td align="right" nowrap="nowrap">
', $post['time'], '
</td>
</tr>';
echo '
</table>';
}

Offline Blue

  • Customizer
  • *
  • Posts: 379
  • Gender: Male
  • Block Maker? =P
Re: Creating a Panels Tab in a Custom PHP Block Completed
« Reply #38 on: July 06, 2011, 05:22:13 PM »
Your file seems fine except for one line but I bet that's not the problem so I did the query for the second tab. It's not the final block, it's just a sketch to see if it works. If it does work then I make it output like you want ;)

Here is the code:
Code: [Select]
<?php
// CODE FROM NOW ON
echo '
<script src="http://www.superheroalliance.net/SpryAssets/SpryTabbedPanels.js" type="text/javascript"></script> 
<link href="http://www.superheroalliance.net/SpryAssets/SpryTabbedPanels.css" rel="stylesheet" type="text/css" />
 
<div id="TabbedPanels1" class="TabbedPanels">
<ul class="TabbedPanelsTabGroup"> 
<li class="TabbedPanelsTab" tabindex="0">All Boards</li> 
<li class="TabbedPanelsTab" tabindex="0">Comics Discussion</li>
                <li class="TabbedPanelsTab" tabindex="0">TV, Movies & Music</li> 
</ul> 
<div class="TabbedPanelsContentGroup"> 
<div class="TabbedPanelsContent">'
;

// START OF FIRST TAB
global $scripturl$settings$context$txt;

        
$what ssi_recentTopics(25nullnull'array');

echo '
<div class="tabsmenucontent" style="padding: 2px">
<table border="0" width="100%" cellspacing="1" cellpadding="2" class="bordercolor">
<tr class="titlebg">
                                <td valign="middle">Topic</td>
<td valign="middle">Poster</td>
<td valign="middle">Time</td>
<td valign="middle"></td>
</tr>'
;

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['time'], '#new"><img src="'$settings['images_url'], '/'$context['user']['language'], '/new.gif" alt="new" border="0" /></a>';

echo '
</td>
<td class="windowbg2" valign="middle">'
$topic['poster']['link'], '</td>
<td class="windowbg2" valign="middle">'
$topic['time'], '</td>
<td class="windowbg2" valign="middle">'
;

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="Last Post" title="Last Post" border="0" style="float: right;" /></a>';
}

echo 
'
</td>
</tr>
</table>
</div>'
;
// END OF FIRST TAB

echo'</div> 
<div class="TabbedPanelsContent">'
;

// START OF SECOND TAB
global $smcFunc$scripturl;
   
$topics_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
   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)
   WHERE m.approved=1 AND t.id_board=28
   ORDER BY t.id_last_msg DESC
   LIMIT 25'
);
$topics = array();
while (
$row_topics $smcFunc['db_fetch_assoc']($topics_result))
{
   
$topics[] = array(
      
'poster' => '<a style="color: ' $row_topics['online_color'] . ';" href="' $scripturl '?action=profile;u=' $row_topics['id_member_updated'] . '">' $row_topics['poster_name'] . '</a>',
      
'link' => '<a title="' $text['board'] . '&nbsp;' $row_topics['name'] .'" href="' $scripturl '?topic=' $row_topics['id_topic'] . '.msg' $row_topics['id_last_msg'] . ';topicseen#new">' $row_topics['subject'] . '</a>',
      
'href' => $scripturl '?topic=' $row_topics['id_topic'] . '.msg' $row_topics['id_last_msg'] . ';topicseen#new',
  'time' => timeformat($row_topics['poster_time'])
   );
}
$smcFunc['db_free_result']($posts_result);
echo '
<div class="tabsmenucontent" style="padding: 2px">
<table border="0" width="100%" cellspacing="1" cellpadding="2" class="bordercolor">
<tr class="titlebg">
                                <td valign="middle">Topic</td>
<td valign="middle">Poster</td>
<td valign="middle">Time</td>
<td valign="middle"></td>
</tr>'
;

foreach ($topics as $topic)
{
echo '
<tr>
<td class="windowbg" valign="middle">'
$topic['link'] ,'
</td>
<td class="windowbg2" valign="middle">'
$topic['poster'], '</td>
<td class="windowbg2" valign="middle">'
$topic['time'], '</td>
<td class="windowbg2" valign="middle">'
;

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="Last Post" title="Last Post" border="0" style="float: right;" /></a>';
}

echo 
'
</td>
</tr>
</table>
</div>'
;
// END OF SECOND TAB

echo'</div> 
</div> 
</div>
 
<script type="text/javascript"> 
<!-- 
var TabbedPanels1 = new Spry.Widget.TabbedPanels("TabbedPanels1"); 
Spry.Widget.TabbedPanels("TabbedPanels2");
//--> 
</script>
'
;


?>
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: 61
  • SMF Version: 2 RC5
  • SP Version: 2.3.3
Re: Creating a Panels Tab in a Custom PHP Block Completed
« Reply #39 on: July 06, 2011, 06:16:00 PM »
Dude, are you like some PHP guru or something? Amazing dude.... Amazing!

Works perfectly but I just one thing, since your new code displays in a different style like usernames with colors I can't use the function ssi_recentTopics for the first tab to display topics from all boards as ssi_recentTopics function doesn't color usernames so I was wondering with your new code, how do I add multiple boards so that for the first tab I can add all boards IDs and then from second, third, fourth tab onwards I could use individual board IDs. I tried separating IDs like 2,6,43.......... but that didn't seem to work. Is there a way? if there isn't it's fine. This is so awesome.... I owe you BIG time buddy..... BIG-effing-TIME!