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

Thanks for having an interest with our portal. If you have any requests for features, have a look at the Feature Requests board.

Author Topic: Blocks In Blocks  (Read 130213 times)

0 Members and 3 Guests are viewing this topic.

Offline FrizzleFried

  • Full Member
  • ***
  • Posts: 114
  • SMF Version: 2.0.5
  • SP Version: 2.3.5
Re: Blocks In Blocks
« Reply #60 on: April 23, 2012, 11:17:28 AM »
Thank you for this thread... because of the ability to put blocks in blocks I was able to set up my page much more efficiently...

One thing I did notice... some blocks are different sizes depending on the browser you are using.  Look at the screen shots below.  SCREENSHOT is from FF and SCREENSHOT2 is from Chrome... I'd aligned the 3 boxes within a box up in a row... looks great in Chrome... not quite so great in Firefox....  the funny thing is that the block on left and right are the SAME BLOCK but with two different settings set... yet only one seems to "shrink"?


Offline AngelinaBelle

  • Comrade
  • *
  • Posts: 4870
  • Gender: Female
  • SMF Version: 2 RC3
  • SP Version: 2.3.2
Re: Blocks In Blocks
« Reply #61 on: April 23, 2012, 02:48:40 PM »
I don't know what your HTML and CSS look like for these.
With some different width controls, you might get different results.
 
If you want some help on scripting, why not open up a new topic on the support or custom coding board?
 
Anyone who is available will try to lend a hand.
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 FrizzleFried

  • Full Member
  • ***
  • Posts: 114
  • SMF Version: 2.0.5
  • SP Version: 2.3.5
Re: Blocks In Blocks
« Reply #62 on: April 23, 2012, 05:09:38 PM »
I don't know what your HTML and CSS look like for these.
With some different width controls, you might get different results.
 
If you want some help on scripting, why not open up a new topic on the support or custom coding board?
 
Anyone who is available will try to lend a hand.

Stock DEFAULT SMF theme ...

:)

What's it called?  Curve?

Offline ARG

  • Beta Tester
  • *
  • Posts: 56
    • Simple Mode Forum
  • SMF Version: 2.0.2
  • SP Version: 2.3.5
Re: Blocks In Blocks
« Reply #63 on: April 24, 2012, 01:26:33 AM »
I don't know what your HTML and CSS look like for these.
With some different width controls, you might get different results.
 
If you want some help on scripting, why not open up a new topic on the support or custom coding board?
 
Anyone who is available will try to lend a hand.

Stock DEFAULT SMF theme ...

:)

What's it called?  Curve?

It's called "Curve" but in your files it will be labeled as "default".

Offline andy

  • On Leave
  • *
  • Posts: 861
  • Gender: Male
    • Outdoor Club Japan (OCJ) アウトドア・クラブ・ジャパン
  • SMF Version: 2.0.15
  • SP Version: 2.3.7
  • Elkarte Version: None
Re: Blocks In Blocks
« Reply #64 on: May 21, 2012, 10:24:46 AM »
I posted something in Bugs... with a comment that it probably wasn't strictly a bug    :)

It seems that permissions for blocks inside other blocks don't work. Probably ignored as those blocks are set inactive anyway.
Everyone is a volunteer here so please try and make a small donation to keep the Simple Portal website running


Offline silvershark

  • Semi Newbie
  • *
  • Posts: 19
  • SMF Version: 2.0.2
  • SP Version: 2.3.5
Re: Blocks In Blocks
« Reply #65 on: October 19, 2012, 09:33:02 AM »
OK, I know this is an old thread, but it was a link given to me by a member on SMF. Finding the block ID is very confusing to me. I have NO coding experience and I don't understand any of this. Now I know you are going to tell me to learn, but that could take some time when all I need is this...I just need to know the block ID for the shout box so I can duplicate it on the portal. I did not understand the "file path" in the first post as to how to find it. I really need this in "stupid" talk because I just don't understand. A simple "click this, click that, click this would be great. I am using the most recent version of SP. I am so sorry to sound so dumb but I have only been doing this for 3 weeks. I understand how to edit the code I believe, I just need to know where to find the ID.

Thanks

Offline phantomm

  • Translator
  • *
  • Posts: 406
  • Gender: Male
  • Smile, tomorrow will be worse...
    • Polish ElkArte community
  • SMF Version: None
  • Elkarte Version: 1.0.5
Re: Blocks In Blocks
« Reply #66 on: October 19, 2012, 09:40:55 AM »
I gave you example at sm.org :)

When you go to block settings you can see ID inside URL

Quote
for example:
/index.php?action=admin;area=portalblocks;sa=edit;block_id=15;f22f830=454d3f3e280abcb5aee69e15d09ff891

In my example block ID = 15

Click at icon related to this block and you'll get similar URL

Offline silvershark

  • Semi Newbie
  • *
  • Posts: 19
  • SMF Version: 2.0.2
  • SP Version: 2.3.5
Re: Blocks In Blocks
« Reply #67 on: October 19, 2012, 09:56:13 AM »
I tried that. but I will look again.  :0

Offline phantomm

  • Translator
  • *
  • Posts: 406
  • Gender: Male
  • Smile, tomorrow will be worse...
    • Polish ElkArte community
  • SMF Version: None
  • Elkarte Version: 1.0.5
Re: Blocks In Blocks
« Reply #68 on: October 19, 2012, 09:58:37 AM »
but remember to go to blocks page, not Shoutbox :)

Offline silvershark

  • Semi Newbie
  • *
  • Posts: 19
  • SMF Version: 2.0.2
  • SP Version: 2.3.5
Re: Blocks In Blocks
« Reply #69 on: October 19, 2012, 10:29:24 AM »
OH Duh...now I get it...man I feel stupid. I was looking for a notation of the ID in the page it's self...haha! Man I am such a newb

Offline silvershark

  • Semi Newbie
  • *
  • Posts: 19
  • SMF Version: 2.0.2
  • SP Version: 2.3.5
Re: Blocks In Blocks
« Reply #70 on: October 19, 2012, 10:48:49 AM »
Great. it worked perfectly. Thanks for the help. I am learning as I go, but I am still very inexperienced

Offline velorooms

  • Jr. Member
  • **
  • Posts: 83
    • Velorooms
  • SMF Version: 2.0.2
  • SP Version: 2.3.5
Re: Blocks In Blocks
« Reply #71 on: October 20, 2012, 10:47:46 AM »
battling this for the last hour..

Want to add a custom php block, block_id 143, to the menu so that it has new posts, new topics, unread posts..

how the blazes do you tell the array to call teh block

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' => 'Unread Posts',
'type' => 'sp_block',
'parameters' => array('block_id' => 143),
),
);

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>';
Admin and Owner of Velorooms.com - Using SMF 2.0.3 and Simpleportal 2.3.5

Offline andy

  • On Leave
  • *
  • Posts: 861
  • Gender: Male
    • Outdoor Club Japan (OCJ) アウトドア・クラブ・ジャパン
  • SMF Version: 2.0.15
  • SP Version: 2.3.7
  • Elkarte Version: None
Re: Blocks In Blocks
« Reply #72 on: October 21, 2012, 01:09:51 AM »
The simplest, easiest way maybe would be to make 3 blocks using the standard SMF blocks available... and perhaps a custom one from the custom blocks board if you need that.
"new posts, new topics, unread posts"

After you have made the 3 blocks (they should be set inactive) you simply put their block ID (all 3 of them) in the blocks in blocks code.
This code is in its own custom PHP block and just calls the others to display inside it using the IDs for them you provided.

You can select options to hide the titles and adjust the css of each sub block so that it looks like just one.

Everyone is a volunteer here so please try and make a small donation to keep the Simple Portal website running


Offline velorooms

  • Jr. Member
  • **
  • Posts: 83
    • Velorooms
  • SMF Version: 2.0.2
  • SP Version: 2.3.5
Re: Blocks In Blocks
« Reply #73 on: October 21, 2012, 06:40:48 AM »
yeh, have the three blocks and set up, but i cant get the custom block to appear. Using the code i put above with the ref as sp_block and then block_id doesnt work for me.. :S
Admin and Owner of Velorooms.com - Using SMF 2.0.3 and Simpleportal 2.3.5

Offline andy

  • On Leave
  • *
  • Posts: 861
  • Gender: Male
    • Outdoor Club Japan (OCJ) アウトドア・クラブ・ジャパン
  • SMF Version: 2.0.15
  • SP Version: 2.3.7
  • Elkarte Version: None
Re: Blocks In Blocks
« Reply #74 on: October 21, 2012, 11:48:43 AM »
I think you are using the wrong piece of code. My site is working fine so you are doing something wrong.

Set the internal blocks to 'not active'. Check the viewing permissions on the main custom php block with the code below in it. Also it should be 'active',  and the internal block IDs should be in the array.

In the block list in admin you can get their IDs from the links. Just put them in the $block_ids = array(49, 50, 52, 53);
Number of columns can be set there too.



Code: [Select]
$columns = 2;
$block_ids = array(49, 50, 52, 53);

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

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

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

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

   $counter++;
}

echo '
   </tr>
</table>';
« Last Edit: October 21, 2012, 11:50:52 AM by igirisjin »
Everyone is a volunteer here so please try and make a small donation to keep the Simple Portal website running


Offline velorooms

  • Jr. Member
  • **
  • Posts: 83
    • Velorooms
  • SMF Version: 2.0.2
  • SP Version: 2.3.5
Re: Blocks In Blocks
« Reply #75 on: October 22, 2012, 11:10:24 AM »
Ah, theres a missunderstanding, thats not the kind of block im trying to create.

Trying to modify the example given earlier in this thread, (see screenshot)

I can add the extra menu item no problem, but i cannot get it to show the additional block using the code as below (block ref 143)

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' => 'Unread Posts',
'type' => 'sp_block',
'parameters' => array('block_id' => 143),
),
);

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>'; 
Admin and Owner of Velorooms.com - Using SMF 2.0.3 and Simpleportal 2.3.5

Offline velorooms

  • Jr. Member
  • **
  • Posts: 83
    • Velorooms
  • SMF Version: 2.0.2
  • SP Version: 2.3.5
Re: Blocks In Blocks
« Reply #76 on: October 22, 2012, 11:12:08 AM »
I get as far as this...

The extra button added but i dont know how to call block 143 in teh array (the block is set as non-active)

Admin and Owner of Velorooms.com - Using SMF 2.0.3 and Simpleportal 2.3.5

Offline andy

  • On Leave
  • *
  • Posts: 861
  • Gender: Male
    • Outdoor Club Japan (OCJ) アウトドア・クラブ・ジャパン
  • SMF Version: 2.0.15
  • SP Version: 2.3.7
  • Elkarte Version: None
Re: Blocks In Blocks
« Reply #77 on: October 23, 2012, 01:24:43 AM »
I haven't used or tested that code - sorry I cant help with that. Hopefully someone else can.

But the way I described using the original blocks in blocks code will work - that is the easiest way I can see at the moment.
Everyone is a volunteer here so please try and make a small donation to keep the Simple Portal website running


Offline dhayzon

  • Jr. Member
  • **
  • Posts: 63
  • Gender: Male
  • http://dhayzon.com/
    • wWw.club-dhayzone.net
  • SMF Version: 2.0.2
  • SP Version: 2.3.5
Re: Blocks In Blocks
« Reply #78 on: October 25, 2012, 02:33:54 PM »
I'm using this code and I have the following error

There is a database error in your code. Please check it.

Code: [Select]
$columns = 3;

$block_ids = array(23, 22, 26, );

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

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

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

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

      </td>';

   $counter++;
}

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

Offline TinMan

  • Semi Newbie
  • *
  • Posts: 43
    • RC Arcade
Re: Blocks In Blocks
« Reply #79 on: October 25, 2012, 04:12:04 PM »
I get as far as this...

The extra button added but i dont know how to call block 143 in teh array (the block is set as non-active)
Are you trying to do this using the Unread Posts block from Here?