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: 704
  • 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 130201 times)

0 Members and 4 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 #40 on: June 07, 2011, 06:19:22 AM »
Correct. Follow the example and start simple, and you should be able to manage this.  IF you've written any code before, you'll know that you re likely to make lots of coding errors. So add only a few lines at a time to make it easier to narrow your errors down.
For support on working this through, please try the custom coding board.
 
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 #41 on: June 07, 2011, 07:07:31 AM »
Correct. Follow the example and start simple, and you should be able to manage this.  IF you've written any code before, you'll know that you re likely to make lots of coding errors. So add only a few lines at a time to make it easier to narrow your errors down.
For support on working this through, please try the custom coding board.

Even Angelina,

Thank you for the quick response, if I have any problems I will seek support where you recommended.

Done coding before and have the grey hairs to prove it.. :'(


Offline unoit

  • Semi Newbie
  • *
  • Posts: 37
  • SMF Version: 2 RC5
  • SP Version: 2.3.3
Re: Blocks In Blocks
« Reply #42 on: July 08, 2011, 05:39:56 PM »
Hi guys,

Im using the 1st set of codes that [SiNaN posted. ok im using the 1st code & 2nd code.

my problem is there a 2 blocks inside 1, but the left hand side block has 6 post & right hand side block only has 2 post in it.

how can i set it up so there is an even amount on both sides.

« Last Edit: July 12, 2011, 07:46:39 AM by unoit »

Offline unoit

  • Semi Newbie
  • *
  • Posts: 37
  • SMF Version: 2 RC5
  • SP Version: 2.3.3
Re: Blocks In Blocks
« Reply #43 on: July 09, 2011, 06:15:35 PM »



all good worked it out
« Last Edit: July 12, 2011, 07:47:14 AM by unoit »

Offline Divecall

  • Full Member
  • ***
  • Posts: 201
  • SMF Version: 2.0.2
  • SP Version: 2.3.5
Re: Blocks In Blocks
« Reply #44 on: July 30, 2011, 06:26:20 PM »
How to add custom-html-code in this "block-code"?

http://simpleportal.net/index.php?topic=5332.msg37841#msg37841

Thank's a lot...

Offline AngelinaBelle

  • Comrade
  • *
  • Posts: 4870
  • Gender: Female
  • SMF Version: 2 RC3
  • SP Version: 2.3.2
Re: Blocks In Blocks
« Reply #45 on: August 23, 2011, 07:28:24 AM »
I have split this question into a new topic:
Custom HTML in blocks-in-blocks
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 dsantana

  • Semi Newbie
  • *
  • Posts: 37
  • SMF Version: 2 RC3
  • SP Version: 2.3.2
Re: Blocks In Blocks
« Reply #46 on: October 14, 2011, 05:37:48 PM »
Read thru all these and didn't see if there was a way to control the block size inside of the block.
Like I want to have two blocks in my block with one having 70% and the other having 30%
Is that possible?

Offline Raji

  • Full Member
  • ***
  • Posts: 102
  • Gender: Female
    • Baaskani Diwwan
  • SMF Version: 2.0.1
  • SP Version: 2.3.4
Re: Blocks In Blocks
« Reply #47 on: November 30, 2011, 03:25:49 AM »
Read thru all these and didn't see if there was a way to control the block size inside of the block.
Like I want to have two blocks in my block with one having 70% and the other having 30%
Is that possible?
I am also waiting for the solution

Offline AngelinaBelle

  • Comrade
  • *
  • Posts: 4870
  • Gender: Female
  • SMF Version: 2 RC3
  • SP Version: 2.3.2
Re: Blocks In Blocks
« Reply #48 on: November 30, 2011, 10:27:15 AM »
You could always lay out your blocks-in-blocks inside a table, and set the width of the table cells. That ought to work.
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 iulyz

  • Newbie
  • Posts: 4
Re: Blocks In Blocks
« Reply #49 on: December 15, 2011, 03:01:27 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.

Hi, can some one help me with a small problem. How can i display  simple ads ex: template_ad_position('below_menu');  in one of this blocs?
I do like this but is not working.
Code: [Select]
function sp_ads()
{
template_ad_position('below_menu');
}

Code: [Select]
array(
'label' => 'ads',
'type' => 'sp_ads',
'parameters' => array('display' => 1),
),

Offline iulyz

  • Newbie
  • Posts: 4
Re: Blocks In Blocks
« Reply #50 on: December 19, 2011, 09:28:01 AM »
find the problem tnx any way
« Last Edit: December 19, 2011, 07:31:29 PM by iulyz »

Offline cnashx

  • Semi Newbie
  • *
  • Posts: 11
  • SMF Version: 2.0
Re: Blocks In Blocks
« Reply #51 on: December 26, 2011, 07:17:34 PM »
Hello.
I have been using the block with the recent topics and recent posts.
And I was wondering what code I could use to exclude forums or subforums from the recent threads or just specify certain forums or subforums.
I'm thinking about having "Recent Tropics/Threads" and another "recent" block for a specific subforum.

Thank you for your help in advance.

Offline Kayrn

  • Semi Newbie
  • *
  • Posts: 6
  • SMF Version: 2.0.1
  • SP Version: 2.3.2
Re: Blocks In Blocks
« Reply #52 on: January 26, 2012, 09:50:33 AM »
Hi :)

First, excuse my average english, it isn't my native langage and I hope you will understand me.

This topic was helpfull for me but I still have a problem. I need to add a rssfeed on my blocks, so I do this :

Code: [Select]
$blocks = array(
array(
'label' => 'News',
'type' => 'sp_BoardNews',
'parameters' => array(),
),
array(
'label' => 'Official News',
'type' => 'sp_rssfeed',
'parameters' => 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),
),

);

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>';

But I still have a problem, because I've got an Invalid Feed error on my front page. Did someone have a solution to this ?

Offline AngelinaBelle

  • Comrade
  • *
  • Posts: 4870
  • Gender: Female
  • SMF Version: 2 RC3
  • SP Version: 2.3.2
Re: Blocks In Blocks
« Reply #53 on: January 26, 2012, 09:56:36 AM »
For the newsfeed block, you will need to supply some parameters, including the feed.
So instead of
Code: [Select]
'parameters' => array(),You want something like
Code: [Select]
'parameters' => array(
                                      'url' => 'put url of your newsfeed here, in single quotes'
                                 ),
 
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 Kayrn

  • Semi Newbie
  • *
  • Posts: 6
  • SMF Version: 2.0.1
  • SP Version: 2.3.2
Re: Blocks In Blocks
« Reply #54 on: January 26, 2012, 10:10:31 AM »
Thx a lot, it works fine :)


Offline AngelinaBelle

  • Comrade
  • *
  • Posts: 4870
  • Gender: Female
  • SMF Version: 2 RC3
  • SP Version: 2.3.2
Re: Blocks In Blocks
« Reply #55 on: January 26, 2012, 10:14:29 AM »
Glad to help! If you have any more questions, you can post them in the support boards.

Thanks!
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 Kayrn

  • Semi Newbie
  • *
  • Posts: 6
  • SMF Version: 2.0.1
  • SP Version: 2.3.2
Re: Blocks In Blocks
« Reply #56 on: January 26, 2012, 10:30:46 AM »
Huhu, more I work, more question I have :P

So now, I have my rssfeed on my Tabs but, I need to have 10 news against of 5 at the moment. Which parameter should I put ?

Bonus Question : How did I increase Height's block ? I've got a Scroller on side and don't want it.

« Last Edit: January 26, 2012, 10:35:19 AM by Kayrn »

Offline Zuki

  • Semi Newbie
  • *
  • Posts: 28
  • Gender: Male
  • SMF Version: 2.0.2
  • SP Version: 2.3.5
Re: Blocks In Blocks
« Reply #57 on: January 31, 2012, 11:39:49 AM »
Hi,

The response on the french-support : http://simpleportal.net/index.php?topic=10635.msg54774#msg54774

your-forum/Sources/PortalBlocks.php

function sp_rssFeed  (line 1944 about)

Quote
$count = !empty($parameters['count']) ? (int) $parameters['count'] : 5;


Change 5 for 10



Bonus Question : To change the height

your-forum/Themes/default/css/portal.css

Line 183   =>   /* Block specific styles  */

Change 300px => increase the value.

Quote
.sp_rss_flow
{
   max-height: 300px;

   overflow: auto;
}


Sorry for my poor english
Greetings
« Last Edit: January 31, 2012, 11:58:58 AM by Zuki »


Offline unoit

  • Semi Newbie
  • *
  • Posts: 37
  • SMF Version: 2 RC5
  • SP Version: 2.3.3
Re: Blocks In Blocks
« Reply #58 on: April 21, 2012, 03:30:53 AM »

is there anyway to change the coding so the blocks run horizontal.

$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>';

Offline AngelinaBelle

  • Comrade
  • *
  • Posts: 4870
  • Gender: Female
  • SMF Version: 2 RC3
  • SP Version: 2.3.2
Re: Blocks In Blocks
« Reply #59 on: April 23, 2012, 07:46:57 AM »
Absolutely.  Use HTML to set them up the way you want.
I recommend a nice tutorial site like w3schools.com to learn the HTML to lay out information the way you want it.
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?