collapse collapse

* User Info

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

* Who's Online

  • Dot Guests: 151
  • Dot Hidden: 0
  • Dot Users: 0

There aren't any users online.

* Shoutbox

Refresh History
  • Shoutbox is not for support!
  • {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
  • phantomm: and from what I see only patch is broken, full install package is fine
    October 21, 2016, 03:44:44 PM

* Recent Posts

Re: Occasional Chat/Shout box Issue by Skhilled
[Today at 04:52:48 AM]


Re: Occasional Chat/Shout box Issue by OpoWolfie
[January 06, 2019, 04:54:46 AM]


Re: Where is the code for these elements, where are they stored? by Chen Zhen
[January 04, 2019, 10:50:07 AM]


Re: Have a block only show on threads? by danmsmith018f
[January 03, 2019, 05:46:35 AM]


Re: Occasional Chat/Shout box Issue by OpoWolfie
[January 03, 2019, 05:33:09 AM]

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

Author Topic: Blocks In Blocks  (Read 88745 times)

0 Members and 2 Guests are viewing this topic.

Offline AngelinaBelle

  • Comrade
  • *
  • Posts: 4870
  • Gender: Female
  • SMF Version: 2 RC3
  • SP Version: 2.3.2
Re: Blocks In Blocks
« Reply #20 on: August 18, 2010, 09:31:46 AM »
I've split a question from this thread and moved it to
 
http://simpleportal.net/index.php?msg=36356
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 frantic

  • Semi Newbie
  • *
  • Posts: 23
  • SMF Version: 2 RC3
  • SP Version: 2.3.2
Re: Blocks In Blocks
« Reply #21 on: August 24, 2010, 09:50:12 PM »
I've noticed that the parent block that holds the split blocks always seems to have extra space at the bottom.  The example has it as well.  Is it possible to have the parent block snug the split blocks?

Offline AngelinaBelle

  • Comrade
  • *
  • Posts: 4870
  • Gender: Female
  • SMF Version: 2 RC3
  • SP Version: 2.3.2
Re: Blocks In Blocks
« Reply #22 on: August 25, 2010, 09:12:21 AM »
That extra space, created with a final "<br />", and part of all blocks, is found in template_block_core and template_block_curve.
Changing it would require a change to every block, unless you used a block-body strategy similar to the one I suggested in http://simpleportal.net/index.php?topic=6232.msg36445#msg36445
Here, perhaps, you would could use a custom class -- sp_no_bottom_break, for example -- in the custom body class field.  If detected, you could choose to leave out the bottom break.
 
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 frantic

  • Semi Newbie
  • *
  • Posts: 23
  • SMF Version: 2 RC3
  • SP Version: 2.3.2
Re: Blocks In Blocks
« Reply #23 on: August 25, 2010, 12:44:27 PM »
Thanks Angelina, i'll try that.

Offline thellie

  • Semi Newbie
  • *
  • Posts: 22
  • SMF Version: 2 RC3
  • SP Version: 2.3.2
Re: Blocks In Blocks
« Reply #24 on: August 29, 2010, 11:45:50 PM »
i'd like to use the javascript version of the blocks in blocks. i want to extend it so that i can have a shoutbox in there as well, but can't get the code right.

i can do the first version myself. thanks to simple, clear instructions. but the second doesn't explain how to add other blocks into the code, in addition to the code shown - which is no help to someone with no javascript knowledge... like me.

here's the original code (version 2)...
Code: [Select]
global $txt;

$txt['recent_topics'] = 'Recent Topics';
$txt['recent_posts'] = 'Recent Posts';

$buttons = array(
   'recent_topics' => array(
      'text' => 'recent_topics',
      'image' => '',
      'lang' => true,
      'url' => '#recent_topics" id="b_rt" onclick="change_display(\'rp\'); return false;',
      'active' => true,
   ),
   'recent_posts' => array(
      'text' => 'recent_posts',
      'image' => '',
      'lang' => true,
      'url' => '#recent_posts" id="b_rp" onclick="change_display(\'rt\'); return false;',
   ),
);

echo '
<div style="overflow: auto;">
   ', template_button_strip($buttons), '
</div>
<div id="recent_topics">
   ', sp_recent(array('type' => 1, 'display' => 1), 0), '
</div>
<div id="recent_posts" style="display: none;">
   ', sp_recent(array('display' => 1), 0), '
</div>
<script language="JavaScript" type="text/javascript"><!-- // --><![CDATA[
   function change_display(block)
   {
      var current = block == \'rt\' ? 1 : 0;

      document.getElementById(\'recent_topics\').style.display = current ? \'none\' : \'\';
      document.getElementById(\'recent_posts\').style.display = current ? \'\' : \'none\';
      document.getElementById(\'b_rt\').className = current ? \'button_strip_recent_topics\' : \'button_strip_recent_topics active\';
      document.getElementById(\'b_rp\').className = current ? \'button_strip_recent_posts active\' : \'button_strip_recent_posts\';
   }
// ]]></script>';

and here's my initial attempt (i get an error at the bottom of the page as well. see below the code)
Code: [Select]
global $txt;

$txt['recent_topics'] = 'Recent Topics';
$txt['recent_posts'] = 'Recent Posts';
$txt['volunteer_shoutbox'] = 'Volunteer Chat!';

$buttons = array(
   'recent_topics' => array(
      'text' => 'recent_topics',
      'image' => '',
      'lang' => true,
      'url' => '#recent_topics" id="b_rt" onclick="change_display(\'rp\'); return false;',
      'active' => true,
   ),
   'recent_posts' => array(
      'text' => 'recent_posts',
      'image' => '',
      'lang' => true,
      'url' => '#recent_posts" id="b_rp" onclick="change_display(\'rt\'); return false;',
   ),
   'volunteer_shoutbox' => array(
      'text' => 'volunteer_shoutbox',
      'image' => '',
      'lang' => true,
      'url' => '#volunteer_shoutbox" id="b_rp" onclick="change_display(\'rt\'); return false;',
   ),
);

echo '
<div style="overflow: auto;">
   ', template_button_strip($buttons), '
</div>
<div id="recent_topics">
   ', sp_recent(array('type' => 1, 'display' => 1), 0), '
</div>
<div id="recent_posts" style="display: none;">
   ', sp_recent(array('display' => 1), 0), '
</div>
<div id="volunteer_shoutbox" style="display: none;">
   ', sp_recent(array('display' => 1), 0), '
</div>
<script language="JavaScript" type="text/javascript"><!-- // --><![CDATA[
   function change_display(block)
   {
      var current = block == \'rt\' ? 1 : 0;

      document.getElementById(\'recent_topics\').style.display = current ? \'none\' : \'\';
      document.getElementById(\'recent_posts\').style.display = current ? \'\' : \'none\';
      document.getElementById(\'volunteer_shoutbox\').style.display = current ? \'\' : \'none\';
      document.getElementById(\'b_rt\').className = current ? \'button_strip_recent_topics\' : \'button_strip_recent_topics active\';
      document.getElementById(\'b_rp\').className = current ? \'button_strip_volunteer_shoutbox active\' : \'button_strip_volunteer_shoutbox\';
   }
// ]]></script>';

and here's the error message:
Fatal error: Call to undefined function: () in /path/to/Sources/Load.php(2124) : eval()'d code on line 173

i would think it's an issue with the
Code: [Select]
      document.getElementById(\'volunteer_shoutbox\').style.display = current ? \'\' : \'none\';

or

Code: [Select]
      document.getElementById(\'b_rp\').className = current ? \'button_strip_volunteer_shoutbox active\' : \'button_strip_volunteer_shoutbox\';

but i don't know enough (by which i mean... anything..!) about javascript to do this myself.

but if someone can help me get this right, i should be able to add other stuff using this as a guide.
thanks :)
« Last Edit: August 29, 2010, 11:52:16 PM by thellie »

Offline [SiNaN]

  • Mr. SimplePortal
  • Developer
  • *
  • Posts: 6782
  • SMF Version: 2.0.15
  • SP Version: 2.3.7
Re: Blocks In Blocks
« Reply #25 on: September 30, 2010, 03:55:18 PM »
I guess that example was a bit difficult for some. Here's a more simple one:

Code: [Select]
$blocks = array(
array(
'label' => 'Recent Posts',
'type' => 'sp_recent',
'parameters' => array('display' => 1),
),
array(
'label' => 'Recent Topics',
'type' => 'sp_recent',
'parameters' => array('type' => 1, 'display' => 1),
),
array(
'label' => 'Top Posters',
'type' => 'sp_topPoster',
'parameters' => array(),
),
array(
'label' => 'Calendar',
'type' => 'sp_calendar',
'parameters' => array(),
),
);

global $txt;

$button_list = array();
foreach ($blocks as $id => $block)
{
$txt['sp_bib_label_' . $id] = $block['label'];

$button_list[] = array(
'text' => 'sp_bib_label_' . $id,
'image' => '',
'lang' => true,
'url' => '#sp_bib_' . $id . '" id="sp_bib_button_' . $id . '" onclick="sp_bib_change(' . $id . '); return false;',
);
}

$button_list[0]['active'] = true;

echo '
<div style="overflow: auto;">
', template_button_strip($button_list), '
</div>';

foreach ($blocks as $id => $block)
{
echo '
<div id="sp_bib_', $id, '"', $id != 0 ? ' style="display: none;"' : '', '>';

$block['type']($block['parameters'], 0);

echo '
</div>';
}

echo '
<script language="JavaScript" type="text/javascript"><!-- // --><![CDATA[
function sp_bib_change(id)
{
for (var i = 0; i < ', count($blocks), '; i++)
{
document.getElementById(\'sp_bib_\' + i).style.display = i == id ? \'\' : \'none\';
document.getElementById(\'sp_bib_button_\' + i).className = \'button_strip_\' + i + (i == id ? \' active\' : \'\');
}
}
// ]]></script>';

What you need to do with this one is; just modify the $blocks array as you like. I mean this one:

Code: [Select]
$blocks = array(
array(
'label' => 'Recent Posts',
'type' => 'sp_recent',
'parameters' => array('display' => 1),
),
array(
'label' => 'Recent Topics',
'type' => 'sp_recent',
'parameters' => array('type' => 1, 'display' => 1),
),
array(
'label' => 'Top Posters',
'type' => 'sp_topPoster',
'parameters' => array(),
),
array(
'label' => 'Calendar',
'type' => 'sp_calendar',
'parameters' => array(),
),
);

"label" will be the block label, "type" is the block function, "parameters" is the array of block parameters.

That's all you need to do.
And slowly, you come to realize... It's all as it should be...

Offline Divecall

  • Full Member
  • ***
  • Posts: 201
  • SMF Version: 2.0.2
  • SP Version: 2.3.5
Re: Blocks In Blocks
« Reply #26 on: September 30, 2010, 05:01:46 PM »
シナン YOU ARE THE BEST !!!

Full working !

GREAT.

I found thru the i-net a nice peace of code, that i want to add for the last topics section. You have an idea how to integrate this ?

this code is to long for to post here, so i attached here.

Offline Divecall

  • Full Member
  • ***
  • Posts: 201
  • SMF Version: 2.0.2
  • SP Version: 2.3.5
Re: Blocks In Blocks
« Reply #27 on: September 30, 2010, 06:31:08 PM »
Really, that is the best code for SP ever. !  :applause: :applause: :applause:

(btw: the shoutbox is not working with this - but for me it is not necessary...)

Offline [SiNaN]

  • Mr. SimplePortal
  • Developer
  • *
  • Posts: 6782
  • SMF Version: 2.0.15
  • SP Version: 2.3.7
Re: Blocks In Blocks
« Reply #28 on: October 01, 2010, 02:26:35 AM »
I found thru the i-net a nice peace of code, that i want to add for the last topics section. You have an idea how to integrate this ?

this code is to long for to post here, so i attached here.

Make this change in the file you attached:

Code: (Find) [Select]
  $ID_MEMBER = $context['user']['id'];
  global $context, $settings, $scripturl, $txt, $db_prefix, $user_info, $modSettings, $user_profile, $smcFunc;

Code: (Replace) [Select]
<?php

  
global $context$settings$scripturl$txt$db_prefix$user_info$modSettings$user_profile$smcFunc;
  
$ID_MEMBER $context['user']['id'];

Save and upload it to Sources directory of your forum. Then at the end of the block code I gave above, add this:

Code: [Select]
function sp_custom_recent()
{
global $sourcedir;

require_once($sourcedir . '/recent post.php');
}

Then you can use 'sp_custom_recent' type in the $blocks array.

Really, that is the best code for SP ever. !  :applause: :applause: :applause:

(btw: the shoutbox is not working with this - but for me it is not necessary...)

Shoutbox will work. You need to pass a shoutbox id to parameters though, like in this example:

Code: [Select]
$blocks = array(
array(
'label' => 'Recent Posts',
'type' => 'sp_recent',
'parameters' => array('display' => 1),
),
array(
'label' => 'Shoutbox',
'type' => 'sp_shoutbox',
'parameters' => array('shoutbox_id' => 1),
),
);
And slowly, you come to realize... It's all as it should be...

Offline Divecall

  • Full Member
  • ***
  • Posts: 201
  • SMF Version: 2.0.2
  • SP Version: 2.3.5
Re: Blocks In Blocks
« Reply #29 on: October 01, 2010, 07:12:30 AM »
GREAT !

I dont know, what i can write for to show you my happiness and for to show you my thankfulness.

T*H*A*N*K  Y*O*U

Offline Divecall

  • Full Member
  • ***
  • Posts: 201
  • SMF Version: 2.0.2
  • SP Version: 2.3.5
Re: Blocks In Blocks
« Reply #30 on: November 19, 2010, 11:27:02 AM »
@シナン :

It is possible to add two tabs more:
- Show unread post since last visit
- Show new replies to your post

?
Thank you in advance, CODEMASTER  :thumbsup:

Offline Divecall

  • Full Member
  • ***
  • Posts: 201
  • SMF Version: 2.0.2
  • SP Version: 2.3.5
Re: Blocks In Blocks
« Reply #31 on: November 19, 2010, 05:22:13 PM »
...and it is possible to add this nice hover/tooltip-effect from here ?

http://simpleportal.net/index.php?topic=1332.msg8762#msg8762

sound like the umltimate-SimplePortal-Block  :D

Must be nice....

Any help is welcome !

Offline DaRKeN

  • Jr. Member
  • **
  • Posts: 50
  • SMF Version: 2 RC5
  • SP Version: 2.3.3
Re: Blocks In Blocks
« Reply #32 on: November 22, 2010, 04:08:40 PM »
Hi! :)

There are some guides in Spanish for this great modification.

Thx ;)!

Offline 130860

  • Super Handsome Language Coordinator
  • Comrade
  • *
  • Posts: 1769
  • Gender: Male
  • You and I are not the same class of pirate!
  • SMF Version: 2 RC3
  • SP Version: 2.3.2
Re: Blocks In Blocks
« Reply #33 on: November 22, 2010, 06:42:59 PM »
@DaRKeN ask in the Spanish support board.

Offline DaRKeN

  • Jr. Member
  • **
  • Posts: 50
  • SMF Version: 2 RC5
  • SP Version: 2.3.3
Re: Blocks In Blocks
« Reply #34 on: November 22, 2010, 07:58:58 PM »
oK, sorry and thx  :thumbsup:

Offline MissyNL

  • Jr. Member
  • **
  • Posts: 73
  • SMF Version: 2 RC4
  • SP Version: 2.3.3
Re: Blocks In Blocks
« Reply #35 on: December 23, 2010, 12:30:30 PM »
Thanks so much for this tutorial! I have alway wanting to have more option for the layout of my frontpage... now it's there :) Thanks!

Offline barbar

  • Semi Newbie
  • *
  • Posts: 22
  • SMF Version: 2 RC4
  • SP Version: 2.3.3
Re: Blocks In Blocks
« Reply #36 on: January 07, 2011, 02:16:43 AM »
seriously when i read this i was so happy. just that i dont know how to code lol. but then again i understand how powerful and useful this thing is, now to find a way to learn how to use it :)

Offline Old Fossil

  • Beta Tester
  • *
  • Posts: 796
  • Gender: Male
  • SMF Version: 2.0.4
  • SP Version: 2.3.5
Re: Blocks In Blocks
« Reply #37 on: January 16, 2011, 06:36:35 PM »
Am looking into this idea with a slight difference.

on my forum www.miltonkeynesaware.co.cc/mkaforum I am looking into making a block for the following.

Traffic Updates (image link to outside source),
Bus timetable (Image link),
Train timetable ( supplied widget),
Petrol prices (supplied widget).

How would I go about this as none of the information would be called from elsewhere within the forum itself.
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 AngelinaBelle

  • Comrade
  • *
  • Posts: 4870
  • Gender: Female
  • SMF Version: 2 RC3
  • SP Version: 2.3.2
Re: Blocks In Blocks
« Reply #38 on: January 17, 2011, 11:30:49 AM »
I assume you mean you want a block with tabs to flip between your widgets.
You do it exactly the same way. 
 
Except you can manage it without putting each widget in a block, if you like. At this point, you would not be using "blocks in blocks" at all, only php and javascript in your custom php block. Which would work just the same as it would on a standalone php page, since there is no connection to SMF at all.
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 nob4uask

  • Semi Newbie
  • *
  • Posts: 35
  • SMF Version: 1.1.13
  • SP Version: 2.3.3
Re: Blocks In Blocks
« Reply #39 on: June 07, 2011, 01:53:34 AM »
Arvo All,

I just installed SP about 2 weeks ago and would like to confirm that I can do what I would like with this. 

Currently I have RSS feeds from 2 different sites and would like to have it for about 4 or 5 sites.  The problem is is that I don't want to make the page to long and also it seems to embed the RSS feed into the previous one if the page extends to far.

After looking at the sample it appears that I can label each site and have the tabs next to each other with one block.  Am I reading this correctly ?

My site is www.thedallascowboysgang.com and if you look in the middle where the RSS feeds are you will be able to tell more about what I am talking about.

Thank you for you time.