This guidance is written for B3P v1.0.5 and higher and will not work for previous versions!
First of, make a new file (your Block) in \styles\your_style\template\portal\block\ and call it i.e. new_block.html
Now you have to decide if this Block will be a center block or if it will be in left or right column.
Last but not least you should know, if your Style is based on prosilver or subsilver2.
Here are the possible combinations: (paste the matching code to your new file)
left/ right Block for prosilver:
Code: Select all
{$LR_BLOCK_H_L}Your_Block_Title{$LR_BLOCK_H_R}
<div style="text-align: center;">
... Place your Code here ...
</div>
{$LR_BLOCK_F_L}{$LR_BLOCK_F_R}
Code: Select all
{$C_BLOCK_H_L}<dt>Your_Block_Title</dt>{$C_BLOCK_H_R}
<ul class="topiclist forums">
<li><dl>
<dd style="border-left: 0px">
... Place your Code here ...
</dd>
</dl></li>
</ul>
{$C_BLOCK_F_L}{$C_BLOCK_F_R}
Code: Select all
{$LR_BLOCK_H_L}Your_Block_Title{$LR_BLOCK_H_R}
<table class="tablebg" cellspacing="1" width="100%">
<tr class="row1">
<td style="text-align:center;">
... Place your Code here ...
</td>
</tr>
</table>
{$LR_BLOCK_F_L}{$LR_BLOCK_F_R}
Code: Select all
{$C_BLOCK_H_L}Your_Block_Title{$C_BLOCK_H_R}
<table class="tablebg" cellspacing="1" width="100%">
<tr class="row1">
<td>
... Place your Code here ...
</td>
</tr>
</table>
{$C_BLOCK_F_L}{$C_BLOCK_F_R}
Now you have to include the Block in your Portal. But there are two possible ways to do it: the new one, and the old one.
Both methods will let you keep your new block after an update. The new method will let you decide where to put your block, the old method will just add your block at a specific position, which is determined by the additional_blocks files. The new method gives you more flexibility, so we recommend you use the new method.
The new method:
Decide where you want to put your block. Depending on that, open styles/*yourstyle*/template/portal/ portal_left.html, portal_center.html or portal_right.html.
In those files, each block is inside an if-statement, i.e. the mainmenu looks like this:
Code: Select all
<!-- IF S_DISPLAY_MAINMENU -->
<!-- INCLUDE portal/block/main_menu.html -->
<!-- ENDIF -->
Code: Select all
<!-- INCLUDE portal/block/new_block.html -->
After you are done, save the file as UTF8 without BOM and make sure to refresh the template cache of your style.
The old method:
open styles\your_style\template\portal\block\additional_blocks_right.html (or additional_blocks_left... / ...center.html)
search for:
Code: Select all
<!-- additional_blocks //-->
Code: Select all
<!-- INCLUDE portal/block/new_block.html -->
OK, thats it. Dont forget to purge the cache after you add a Block.
Further information about how to move Blocks position: Knowledge Base: Moving blocks / change order
Adding PHP Code for your block
If you need to execute PHP code for your new block, there is an easy way to do this. Adding PHP Code to the block file will not do anything at all. Open portal/block/additional_blocks.php and add your PHP right in front of this:
Code: Select all
?>
Here you can discuss this Article: http://board3.de/viewtopic.php?f=21&t=310
Quicklink:
Code: Select all
[url=http://www.board3.de/knowledge/kb_show.php?id=51]Knowledge Base: Adding Custom Blocks[/url]