SimplePortal

Customization => Blocks and Modifications => Block Requests => Topic started by: Mulwa on July 04, 2014, 05:56:39 AM

Title: Making blocks in simple portal blocks
Post by: Mulwa on July 04, 2014, 05:56:39 AM
please is there anyway i can add blocks in simple portal blocks?
Title: Re: Please i need a way to make blocks in simple portal block
Post by: dhayzon on July 04, 2014, 04:33:41 PM
http://simpleportal.net/index.php?topic=5332.0 ?? 
Title: Re: Please i need a way to make blocks in simple portal block
Post by: [SiNaN] on July 05, 2014, 05:53:57 PM
Cleaned up the title a little bit again.

Has the topic linked above helped you with your question?
Title: Re: Making blocks in simple portal blocks
Post by: Mulwa on July 06, 2014, 12:22:52 PM
@Sinan, i didn't understand what's in that link post. I want four blocks in a single block (e.g. I would like to put: facebook link in one, twitter in one, subscribe in one, google plus in the other), what is in that link that was given above is just complicated and no newbie can easily do it, pls help me out
Title: Re: Making blocks in simple portal blocks
Post by: andy on July 08, 2014, 01:07:07 AM
Here is a summary/copy


First
Create the blocks you want inside the main block (Facebook, Twitter etc).
You decide the type you need...php or html etc.
Do not set the blocks 'Active'.
Position does not matter as they are in another block.


Second
Get the ID numbers of the blocks you just created.
You can find them by looking at the link in the blocks list - the number will be at the end.

Third
Make the main block (the others will go inside). This is a custom php block and set active in the position you want.

Setting is for only 2 things:

$columns = x;
Decide how many columns across the page (4x1 or 2x2?). You will probably use 1 line of 4 blocks so set it to  $columns = 4

$block_ids = array(a,b,c,d);
a,b,c,d will be your Facebook, Twitter,subscribe and Googleplus block ID's.

Copy this code inside the block (with your own block ID's and column setting)

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>';
Title: Re: Making blocks in simple portal blocks
Post by: Mulwa on July 08, 2014, 04:28:05 PM
you rock man! Am gonna try this out on my localhost, though am not sure whether it's gonna work on localhost. It's just clear and simple. Dumb up sir!
Title: Re: Making blocks in simple portal blocks
Post by: Mulwa on July 19, 2014, 10:13:15 PM
thanks @Andy.
I was unlucky that it couldn't work for Me, though am using localhost as for now before i'll make it live. I used html for those blocks that i'd like to be in the same block and made then inactive. And used the host block as php and it's shows errors in the block. I don't really know if it could work on localhost either.
Thanks for your support.
Title: Re: Making blocks in simple portal blocks
Post by: Mstcool on July 21, 2014, 04:32:17 AM
What do you mean by localhost?
Title: Re: Making blocks in simple portal blocks
Post by: Mulwa on July 21, 2014, 04:22:47 PM
localhost is a server that you can use in your system without the use of internet connection. Example, wampserver
Title: Re: Making blocks in simple portal blocks
Post by: swoodie on March 20, 2016, 07:30:26 PM
Here is a summary/copy


First
Create the blocks you want inside the main block (Facebook, Twitter etc).
You decide the type you need...php or html etc.
Do not set the blocks 'Active'.
Position does not matter as they are in another block.


Second
Get the ID numbers of the blocks you just created.
You can find them by looking at the link in the blocks list - the number will be at the end.

Third
Make the main block (the others will go inside). This is a custom php block and set active in the position you want.

Setting is for only 2 things:

$columns = x;
Decide how many columns across the page (4x1 or 2x2?). You will probably use 1 line of 4 blocks so set it to  $columns = 4

$block_ids = array(a,b,c,d);
a,b,c,d will be your Facebook, Twitter,subscribe and Googleplus block ID's.

Copy this code inside the block (with your own block ID's and column setting)

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

hi can the above be used like this page http:// daiwafishing .com.au/ where  it has there news  & make the blocks look like that?????
Title: Re: Making blocks in simple portal blocks
Post by: ♦ Ninja ZX-10RR ♦ on March 20, 2016, 09:51:18 PM
Yes, try it! ;)
Title: Re: Making blocks in simple portal blocks
Post by: swoodie on March 21, 2016, 01:05:00 AM
all good working  :)
Title: Re: Making blocks in simple portal blocks
Post by: swoodie on March 21, 2016, 11:51:29 PM
Hi again how would i go about making the pictures move like  they do on the page when hovering over them would that be java script as well?
SimplePortal 2.3.7 © 2008-2022, SimplePortal