HOW-TO: Create new blocks

Step 1: Administration Panel -> Portal Admin -> Add Portal Blocks

Select a name for your block. This should be simple, and easy to identify what the block does.
Make sure you don't use any duplicate names.

Step 2: The contents

The contents of the block is basic HTML. You need to make sure you close all <table>, <tr>, and <td> tags.


Step 3: Portal Display Order

This is similar to the display order of the forums. Just put there whichever order you want it to appear.
You will need to compare this number with the other blocks so that you do not have any duplicates.

Step 4: Portal Display Direction

This is quite simply, which side of the portal do you want this to display. Left, Center, or Right.

Step 5: Portal Block Status

Enabled or Disabled. If enabled, then the block will show in the portal, otherwise it will not.

Step 6:

when you make a new portal block you must add the portal block name to the loadtemplates(); function in portal.php

Example:

'portal_quick_reg'

Replace With:

'portal_quick_reg',
'portal_blockname'


The basic layout of a new block is:


-------------------------------------------------------------------------------

<table cellspacing="0" cellpadding="0" border="0" width="100%" bgcolor="$THEME[bordercolor]">
<tr>
<td>
<table border="0" cellspacing="$THEME[borderwidth]" cellpadding="$THEME[tablespace]" width="100%">
<tr class="category">
<td><strong><font color="$THEME[cattext]">&raquo; Example</font></strong></td>
</tr>
<tr>
<td bgcolor="$THEME[altbg2]" class="tablerow">
<font class="mediumtxt">Example</font>
</td>
</tr>
</table>
</td>
</tr>
</table>

-------------------------------------------------------------------------------

Of course, they can be more or less complex as you want them to be.


***Do you need PHP code within the block?***

If you need to add custom PHP code for your block, then add it in portal.php above the following:

-------------------------------------------------------------------------------
$sql = $db->query("SELECT p.*, t.* FROM ".X_PREFIX."portal_templates p LEFT JOIN ".X_PREFIX."templates t ON t.name=p.name WHERE p.status='on' ORDER BY p.displayorder ASC LIMIT 0, 30");
while($block = $db->fetch_array($sql)) {
    if ($block['direction'] == 'center' && $block['status'] == 'on' && $block['displayorder'] == $block['displayorder']) {
        eval('$center[] = "'.template($block['name']).'";');
    } else if ($block['direction'] == 'right' && $block['status'] == 'on' && $block['displayorder'] == $block['displayorder']) {
        eval('$right[] = "'.template($block['name']).'";');
    } else if ($block['direction'] == 'left' && $block['status'] == 'on' && $block['displayorder'] == $block['displayorder']) {
        eval('$left[] = "'.template($block['name']).'";');
    }
}
$centerblock = implode('<br />', $center);
$rightblock = implode('<br />', $right);
$leftblock = implode('<br />', $left);
$db->free_result($sql);
-------------------------------------------------------------------------------


All done!