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: 327
  • 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]

Installation errors? Mod incompatibilities? Upgrade problems? Make your way over to the Install and Upgrade Support board for all your solutions!

Author Topic: Creating a Panels Tab in a Custom PHP Block Completed  (Read 89135 times)

0 Members and 5 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 #40 on: July 06, 2011, 09:54:03 PM »
Finally!

Here, I think the block is done ;) The Setup (number of topics and included boards) is inside each tab.

Code: [Select]
<?php
/*
The Setup is inside the tab!
Have Fun,
Blue @ Simple Portal.net

Credits to nob4uask for the Tabs tutorial: Thank You!
*/


// Basic Coding before TABS
echo '
<script src="SpryAssets/SpryTabbedPanels.js" type="text/javascript"></script> 
<link href="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">Board IDs 1</li>
        <li class="TabbedPanelsTab" tabindex="0">Board IDs 2</li> 
</ul> 
<div class="TabbedPanelsContentGroup"> 
<div class="TabbedPanelsContent">'
;

/***************************************************************************
*************** START THE TAB **********************************************
***************************************************************************/


// [SETUP HERE] //
$num_recent 25; // HOW MANY RECENT TOPICS TO OUTPUT?
$include_boards null; // IF ALL BOARDS null | IF SOME BOARDS array( ID1, ID2, ID3)



// code, code, code and some more code bahhh!
global $smcFunc$scripturl$context$settings$db_prefix$user_info;

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();
}

$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, b.id_board, 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
   INNER JOIN {db_prefix}boards AS b ON (t.id_board = b.id_board)
   INNER 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 = 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 m.approved=1' 
. (empty($include_boards) ? '' '
AND b.id_board IN ({array_int:include_boards})'
) . '
   ORDER BY t.id_last_msg DESC
   LIMIT ' 
$num_recent
array(
'current_member' => $user_info['id'],
'include_boards' => empty($include_boards) ? '' $include_boards,
)   
   );
$topics = array();
while (
$row_topics $smcFunc['db_fetch_assoc']($topics_result))
{
   
$topics[] = array(
      
'topic' => $row_topics['id_topic'],
      
'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="In&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']),
  'new' => !empty($row_topics['is_read'])
   );
}
$smcFunc['db_free_result']($topics_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'];

// new log! What a headache!
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'], '</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 THE TAB ************************************************
***************************************************************************/

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

/***************************************************************************
*************** START THE TAB **********************************************
***************************************************************************/


// [SETUP HERE] //
$num_recent 25; // HOW MANY RECENT TOPICS TO OUTPUT?
$include_boards = array(1); // IF ALL BOARDS null | IF SOME BOARDS array( ID1, ID2, ID3)



// code, code, code and some more code bahhh!
global $smcFunc$scripturl$context$settings$db_prefix$user_info;

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();
}

$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, b.id_board, 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
   INNER JOIN {db_prefix}boards AS b ON (t.id_board = b.id_board)
   INNER 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 = 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 m.approved=1' 
. (empty($include_boards) ? '' '
AND b.id_board IN ({array_int:include_boards})'
) . '
   ORDER BY t.id_last_msg DESC
   LIMIT ' 
$num_recent
array(
'current_member' => $user_info['id'],
'include_boards' => empty($include_boards) ? '' $include_boards,
)   
   );
$topics = array();
while (
$row_topics $smcFunc['db_fetch_assoc']($topics_result))
{
   
$topics[] = array(
      
'topic' => $row_topics['id_topic'],
      
'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="In&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']),
  'new' => !empty($row_topics['is_read'])
   );
}
$smcFunc['db_free_result']($topics_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'];

// new log! What a headache!
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'], '</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 THE TAB ************************************************
***************************************************************************/


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

/***************************************************************************
*************** START THE TAB **********************************************
***************************************************************************/


// [SETUP HERE] //
$num_recent 25; // HOW MANY RECENT TOPICS TO OUTPUT?
$include_boards = array(2); // IF ALL BOARDS null | IF SOME BOARDS array( ID1, ID2, ID3)



// code, code, code and some more code bahhh!
global $smcFunc$scripturl$context$settings$db_prefix$user_info;

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();
}

$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, b.id_board, 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
   INNER JOIN {db_prefix}boards AS b ON (t.id_board = b.id_board)
   INNER 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 = 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 m.approved=1' 
. (empty($include_boards) ? '' '
AND b.id_board IN ({array_int:include_boards})'
) . '
   ORDER BY t.id_last_msg DESC
   LIMIT ' 
$num_recent
array(
'current_member' => $user_info['id'],
'include_boards' => empty($include_boards) ? '' $include_boards,
)   
   );
$topics = array();
while (
$row_topics $smcFunc['db_fetch_assoc']($topics_result))
{
   
$topics[] = array(
      
'topic' => $row_topics['id_topic'],
      
'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="In&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']),
  'new' => !empty($row_topics['is_read'])
   );
}
$smcFunc['db_free_result']($topics_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'];

// new log! What a headache!
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'], '</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 THE TAB ************************************************
***************************************************************************/

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


?>

Dude, are you like some PHP guru or something? Amazing dude.... Amazing!

I'm not a PHP guru. I'm just learning. I knew that it would work with a query but I wanted to try with recentTopics SMF function. Don't know why it did not work in your website although it worked in my and yours test forum. Oh well...

SiNaN is the PHP guru :applause:

I'm just learning ;)
« Last Edit: July 06, 2011, 10:06:06 PM by Blue »
Please to keep this website running, if you like SimplePortal, make a
one-time subscription. Thank you for your support.

Offline S@ffz

  • Jr. Member
  • **
  • Posts: 51
  • SMF Version: 2.0.2
  • SP Version: 2.3.5
Re: Creating a Panels Tab in a Custom PHP Block Completed
« Reply #41 on: July 06, 2011, 09:59:09 PM »
This looks really handy you guyz are awsome, working out all this code

Offline S@ffz

  • Jr. Member
  • **
  • Posts: 51
  • SMF Version: 2.0.2
  • SP Version: 2.3.5
Re: Creating a Panels Tab in a Custom PHP Block Completed
« Reply #42 on: July 06, 2011, 10:00:57 PM »
blue you have been a great help to many  user on here, all you guys have so keep up the good work

 ;)
« Last Edit: July 06, 2011, 10:07:12 PM by saffz »

Offline Blue

  • Customizer
  • *
  • Posts: 379
  • Gender: Male
  • Block Maker? =P
Re: Creating a Panels Tab in a Custom PHP Block Completed
« Reply #43 on: July 06, 2011, 10:09:01 PM »
This looks really handy you guyz are awsome, working out all this code

Some of the code is from nob4uask, some is from agent47, some is from me and the other some belongs to ssi_recentTopics aka possibly SiNaN.

What a great community don't you think? ;)

blue you have been a great help to many  user on here, all you guys have so keep up the good work

I'm just glad that you guys appreciate my help :)
Please to keep this website running, if you like SimplePortal, make a
one-time subscription. Thank you for your support.

Offline S@ffz

  • Jr. Member
  • **
  • Posts: 51
  • SMF Version: 2.0.2
  • SP Version: 2.3.5
Re: Creating a Panels Tab in a Custom PHP Block Completed
« Reply #44 on: July 06, 2011, 10:11:18 PM »
This looks really handy you guyz are awsome, working out all this code

Some of the code is from nob4uask, some is from agent47, some is from me and the other some belongs to ssi_recentTopics aka possibly SiNaN.

What a great community don't you think? ;)

blue you have been a great help to many  user on here, all you guys have so keep up the good work

I'm just glad that you guys appreciate my help :)

I agree this is a great community

Offline S@ffz

  • Jr. Member
  • **
  • Posts: 51
  • SMF Version: 2.0.2
  • SP Version: 2.3.5
Re: Creating a Panels Tab in a Custom PHP Block Completed
« Reply #45 on: July 06, 2011, 10:13:41 PM »
I don't get the tabs on ur last code Blue     :(

Offline S@ffz

  • Jr. Member
  • **
  • Posts: 51
  • SMF Version: 2.0.2
  • SP Version: 2.3.5
Re: Creating a Panels Tab in a Custom PHP Block Completed
« Reply #46 on: July 06, 2011, 10:14:59 PM »
the code you submitted before that one i get the tabs weird

Offline Blue

  • Customizer
  • *
  • Posts: 379
  • Gender: Male
  • Block Maker? =P
Re: Creating a Panels Tab in a Custom PHP Block Completed
« Reply #47 on: July 06, 2011, 10:17:25 PM »
You have to upload the files attached to your main SMF folder in order to work with Tab effect ;)
Please to keep this website running, if you like SimplePortal, make a
one-time subscription. Thank you for your support.

Offline S@ffz

  • Jr. Member
  • **
  • Posts: 51
  • SMF Version: 2.0.2
  • SP Version: 2.3.5
Re: Creating a Panels Tab in a Custom PHP Block Completed
« Reply #48 on: July 06, 2011, 10:19:42 PM »
My bad I didn't read back you already posted them soz Blue
thanks will do that right now  :D

ok i got it
« Last Edit: July 06, 2011, 10:30:27 PM by saffz »

Offline S@ffz

  • Jr. Member
  • **
  • Posts: 51
  • SMF Version: 2.0.2
  • SP Version: 2.3.5
Re: Creating a Panels Tab in a Custom PHP Block Completed
« Reply #49 on: July 06, 2011, 10:35:33 PM »
strange still no tabs image same as before

Offline Blue

  • Customizer
  • *
  • Posts: 379
  • Gender: Male
  • Block Maker? =P
Re: Creating a Panels Tab in a Custom PHP Block Completed
« Reply #50 on: July 06, 2011, 10:40:10 PM »
Create a folder called SpryAssets then download the attached js & css files into the folder.  This folder will need to be upload to your root directory.

After that, it will work :)
« Last Edit: July 06, 2011, 10:48:51 PM by Blue »
Please to keep this website running, if you like SimplePortal, make a
one-time subscription. Thank you for your support.

Offline S@ffz

  • Jr. Member
  • **
  • Posts: 51
  • SMF Version: 2.0.2
  • SP Version: 2.3.5
Re: Creating a Panels Tab in a Custom PHP Block Completed
« Reply #51 on: July 06, 2011, 11:00:04 PM »
like this?
Code: [Select]
<script src="http://websitehere.com/test_forum/SpryAssets/SpryTabbedPanels.js" type="text/javascript"></script>
<link href="http://websitehere.com/test_forum/SpryAssets/SpryTabbedPanels.css" rel="stylesheet" type="text/css" />
« Last Edit: July 06, 2011, 11:02:46 PM by saffz »

Offline S@ffz

  • Jr. Member
  • **
  • Posts: 51
  • SMF Version: 2.0.2
  • SP Version: 2.3.5
Re: Creating a Panels Tab in a Custom PHP Block Completed
« Reply #52 on: July 06, 2011, 11:01:01 PM »
Create a folder called SpryAssets then download the attached js & css files into the folder.  This folder will need to be upload to your root directory.

After that, it will work :)

have done the folder is on the server

Offline S@ffz

  • Jr. Member
  • **
  • Posts: 51
  • SMF Version: 2.0.2
  • SP Version: 2.3.5
Re: Creating a Panels Tab in a Custom PHP Block Completed
« Reply #53 on: July 06, 2011, 11:05:42 PM »
its ok i found my mistake i spelt folder wrong :-[
It Worked
« Last Edit: July 06, 2011, 11:09:07 PM by saffz »

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 #54 on: July 07, 2011, 06:05:17 AM »
You my friend are a true genius.... We owe quite alot to you Blue. You're amazing!
Look how spectacular your made has my site look > http://www.superheroalliance.net

Offline nob4uask

  • Semi Newbie
  • *
  • Posts: 35
  • SMF Version: 1.1.13
  • SP Version: 2.3.3
Re: Creating a Panels Tab in a Custom PHP Block Completed
« Reply #55 on: July 07, 2011, 06:29:27 AM »
You my friend are a true genius.... We owe quite alot to you Blue. You're amazing!
Look how spectacular your made has my site look > http://www.superheroalliance.net

Even Agent,

Looks good.

Offline Blue

  • Customizer
  • *
  • Posts: 379
  • Gender: Male
  • Block Maker? =P
Re: Creating a Panels Tab in a Custom PHP Block Completed
« Reply #56 on: July 07, 2011, 08:53:29 AM »
Look how spectacular your made has my site look > http://www.superheroalliance.net

I've notice that you use Display name (Hitman) instead of username (admin). Here is the block showing display name:

Code: [Select]
<?php
/*
The Setup is inside the tab!
Have Fun,
Blue @ Simple Portal.net

Credits to nob4uask for the Tabs tutorial: Thank You!
*/


// Basic Coding before TABS
echo '
<script src="SpryAssets/SpryTabbedPanels.js" type="text/javascript"></script> 
<link href="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">Board IDs 1</li>
        <li class="TabbedPanelsTab" tabindex="0">Board IDs 2</li> 
</ul> 
<div class="TabbedPanelsContentGroup"> 
<div class="TabbedPanelsContent">'
;

/***************************************************************************
*************** START THE TAB **********************************************
***************************************************************************/


// [SETUP HERE] //
$num_recent 25; // HOW MANY RECENT TOPICS TO OUTPUT?
$include_boards null; // IF ALL BOARDS null | IF SOME BOARDS array( ID1, ID2, ID3)



// code, code, code and some more code bahhh!
global $smcFunc$scripturl$context$settings$db_prefix$user_info;

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();
}

$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, b.id_board, t.id_last_msg, u.real_name, 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
   INNER JOIN {db_prefix}boards AS b ON (t.id_board = b.id_board)
   INNER 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 = 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 m.approved=1' 
. (empty($include_boards) ? '' '
AND b.id_board IN ({array_int:include_boards})'
) . '
   ORDER BY t.id_last_msg DESC
   LIMIT ' 
$num_recent
array(
'current_member' => $user_info['id'],
'include_boards' => empty($include_boards) ? '' $include_boards,
)   
   );
$topics = array();
while (
$row_topics $smcFunc['db_fetch_assoc']($topics_result))
{
   
$topics[] = array(
      
'topic' => $row_topics['id_topic'],
      
'poster' => '<a style="color: ' $row_topics['online_color'] . ';" href="' $scripturl '?action=profile;u=' $row_topics['id_member_updated'] . '">' $row_topics['real_name'] . '</a>',
      
'link' => '<a title="In&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']),
  'new' => !empty($row_topics['is_read'])
   );
}
$smcFunc['db_free_result']($topics_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'];

// new log! What a headache!
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'], '</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 THE TAB ************************************************
***************************************************************************/

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

/***************************************************************************
*************** START THE TAB **********************************************
***************************************************************************/


// [SETUP HERE] //
$num_recent 25; // HOW MANY RECENT TOPICS TO OUTPUT?
$include_boards = array(1); // IF ALL BOARDS null | IF SOME BOARDS array( ID1, ID2, ID3)



// code, code, code and some more code bahhh!
global $smcFunc$scripturl$context$settings$db_prefix$user_info;

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();
}

$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, b.id_board, t.id_last_msg, u.real_name, 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
   INNER JOIN {db_prefix}boards AS b ON (t.id_board = b.id_board)
   INNER 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 = 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 m.approved=1' 
. (empty($include_boards) ? '' '
AND b.id_board IN ({array_int:include_boards})'
) . '
   ORDER BY t.id_last_msg DESC
   LIMIT ' 
$num_recent
array(
'current_member' => $user_info['id'],
'include_boards' => empty($include_boards) ? '' $include_boards,
)   
   );
$topics = array();
while (
$row_topics $smcFunc['db_fetch_assoc']($topics_result))
{
   
$topics[] = array(
      
'topic' => $row_topics['id_topic'],
      
'poster' => '<a style="color: ' $row_topics['online_color'] . ';" href="' $scripturl '?action=profile;u=' $row_topics['id_member_updated'] . '">' $row_topics['real_name'] . '</a>',
      
'link' => '<a title="In&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']),
  'new' => !empty($row_topics['is_read'])
   );
}
$smcFunc['db_free_result']($topics_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'];

// new log! What a headache!
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'], '</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 THE TAB ************************************************
***************************************************************************/


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

/***************************************************************************
*************** START THE TAB **********************************************
***************************************************************************/


// [SETUP HERE] //
$num_recent 25; // HOW MANY RECENT TOPICS TO OUTPUT?
$include_boards = array(2); // IF ALL BOARDS null | IF SOME BOARDS array( ID1, ID2, ID3)



// code, code, code and some more code bahhh!
global $smcFunc$scripturl$context$settings$db_prefix$user_info;

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();
}

$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, b.id_board, t.id_last_msg, u.real_name, 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
   INNER JOIN {db_prefix}boards AS b ON (t.id_board = b.id_board)
   INNER 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 = 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 m.approved=1' 
. (empty($include_boards) ? '' '
AND b.id_board IN ({array_int:include_boards})'
) . '
   ORDER BY t.id_last_msg DESC
   LIMIT ' 
$num_recent
array(
'current_member' => $user_info['id'],
'include_boards' => empty($include_boards) ? '' $include_boards,
)   
   );
$topics = array();
while (
$row_topics $smcFunc['db_fetch_assoc']($topics_result))
{
   
$topics[] = array(
      
'topic' => $row_topics['id_topic'],
      
'poster' => '<a style="color: ' $row_topics['online_color'] . ';" href="' $scripturl '?action=profile;u=' $row_topics['id_member_updated'] . '">' $row_topics['real_name'] . '</a>',
      
'link' => '<a title="In&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']),
  'new' => !empty($row_topics['is_read'])
   );
}
$smcFunc['db_free_result']($topics_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'];

// new log! What a headache!
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'], '</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 THE 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 kimyaci

  • Full Member
  • ***
  • Posts: 127
  • Gender: Male
    • Forumigo8navigation
  • SMF Version: 2.0.7
  • SP Version: 2.3.5
Re: Creating a Panels Tab in a Custom PHP Block Completed
« Reply #57 on: July 07, 2011, 09:16:15 AM »
I would like to make seven tabs.SpryAssets1, / SpryAssets2, / SpryAssets3 ... I saved the files in the format of the root. However, SpryTabbedPanels.js files affect eachother.What should I do? Thanks.
SMF 2.0.7 HabboArtv1, Default Themes.

Offline nob4uask

  • Semi Newbie
  • *
  • Posts: 35
  • SMF Version: 1.1.13
  • SP Version: 2.3.3
Re: Creating a Panels Tab in a Custom PHP Block Completed
« Reply #58 on: July 07, 2011, 10:10:20 AM »
I would like to make seven tabs.SpryAssets1, / SpryAssets2, / SpryAssets3 ... I saved the files in the format of the root. However, SpryTabbedPanels.js files affect eachother.What should I do? Thanks.

Morn kim,

If I understand you correctly you want seven different panels tab blocks not just seven different tabs on one block.  If you are looking at making seven different panels tab blocks I addressed this earlier.


Morn All,

Just a little update. 

I was adding another Panels Tab Custom PHP block to my front page and things went a little flacky.  After doing some testing I figured out what was wrong.  If you are going to have more than one block  you need to make sure you make changes to the following lines of code.

<div id='TabbedPanels1' class='TabbedPanels'>

var TabbedPanels1 = new Spry.Widget.TabbedPanels('TabbedPanels1')

You can see that the id of the first panel is 'TabbedPanels1".  You will need to change the "1" to a "2", "3" or how many ever blocks you have.




I think that should take care of it, unless I mis-understood you.  If you take a look at the site in my sig you will see 2 different custom php blocks with a panels tab in each one.


« Last Edit: July 07, 2011, 10:15:11 AM by nob4uask »

Offline kimyaci

  • Full Member
  • ***
  • Posts: 127
  • Gender: Male
    • Forumigo8navigation
  • SMF Version: 2.0.7
  • SP Version: 2.3.5
Re: Creating a Panels Tab in a Custom PHP Block Completed
« Reply #59 on: July 07, 2011, 11:00:23 AM »
If you look at my site.I also have 7 different tabs.But I would like to change the tabs.Because a little problematic.Exactly how did you two Tabs? Thanks for your information.
SMF 2.0.7 HabboArtv1, Default Themes.