SimplePortal

Customization => Custom Coding => Topic started by: Shane on November 30, 2009, 12:11:47 AM

Title: Front Page Lay-out Modifications
Post by: Shane on November 30, 2009, 12:11:47 AM
Not really sure how to explain this, but I will try.

There are multiple block area's (ie Left, Right, Top, Bottom). I wanted to turn the 'TOP' area into two columns. Basically, I am going to have two article type blocks in that area and I want them to be side-by-side.

The problem is I am new to SimplePortal and have no clue where to look to figure this out, and even if I do find it I am kind of uncertain how to change it. So every bit of help would be very appreciated.

If my explanation wasn't good, here is an ugly text based graphic to make more sense :|

+------------------------------------------------------------+
|                            HEADER                                    |
|                                                                            |
+----------+------------------+----------------+----------+
|              |                        |                     |              |
|              |                        T                    |              |
|              |                        |                     |              |
|      L      +------------------+----------------+       R    |                                              |              |                                              |              |
|              |                                              |              |
|              |                                              |              |
|              |                        B                    |              |
|              |                                              |              |
+----------+----------------------------------------------- +
|                                                                             |
|                   FOOTER                                             |
+------------------------------------------------------------+
Title: Re: Front Page Lay-out Modifications
Post by: Shane on November 30, 2009, 12:12:33 AM
Bit of formatting problems, but I think you should be able to understand my problem.
Title: Re: Front Page Lay-out Modifications
Post by: Nathaniel on December 25, 2009, 08:35:20 PM
You will want to edit the 'Themes/default/Portal.template.php' file. The 'template_portal_above' function contains the content which is displayed before the main section, the 'template_portal_below' function displays the content which is after the main content.

If you can't work out how to change those functions then I can post some edits.
Title: Re: Front Page Lay-out Modifications
Post by: Shane on December 25, 2009, 08:49:31 PM
Thanks Nathaniel, I would have never found that. I went through the file and was completely unable to figure it out (I am not a programmer, I just make guesses that happen to work most of the time). So if you wouldn't mind showing me I would really appreciate it. Here is the code from my file, not sure if that changes depending on packages, but just incase here it all is.

Code: [Select]
<?php
// Version: 2.3; Portal

function template_portal_above()
{
global $context$modSettings;

if (empty($modSettings['sp_disable_side_collapse']) && ((!empty($modSettings['showleft']) && !empty($context['SPortal']['blocks'][1])) || (!empty($modSettings['showright']) && !empty($context['SPortal']['blocks'][4]))))
{
echo '
<div class="sp_right sp_fullwidth">'
;

if (!empty($modSettings['showleft']) && !empty($context['SPortal']['blocks'][1]))
echo '
<a href="#side" onclick="return sp_collapseSide(1)">'
sp_embed_image($context['SPortal']['sides'][1]['collapsed'] ? 'expand' 'collapse'''nullnulltrue'sp_collapse_side1'), '</a>';

if (!empty($modSettings['showright']) && !empty($context['SPortal']['blocks'][4]))
echo '
<a href="#side" onclick="return sp_collapseSide(4)">'
sp_embed_image($context['SPortal']['sides'][4]['collapsed'] ? 'expand' 'collapse'''nullnulltrue'sp_collapse_side4'), '</a>';

echo '
</div>'
;
}

echo '
<table id="sp_main">
<tr>'
;

if (!empty($modSettings['showleft']) && !empty($context['SPortal']['blocks'][1]))
{
echo '
<td id="sp_left"'
, !empty($modSettings['leftwidth']) ? ' width="' $modSettings['leftwidth'] . '"' ''$context['SPortal']['sides'][1]['collapsed'] && empty($modSettings['sp_disable_side_collapse']) ? ' style="display: none;"' '''>';

foreach ($context['SPortal']['blocks'][1] as $block)
template_block($block);

echo '
</td>'
;
}

echo '
<td id="sp_center">'
;

if (!empty($context['SPortal']['blocks'][2]))
foreach ($context['SPortal']['blocks'][2] as $block)
template_block($block);
}

function 
template_portal_below()
{
global $context$modSettings;

echo '
<br />'
;

if (!empty($context['SPortal']['blocks'][3]))
foreach ($context['SPortal']['blocks'][3] as $block)
template_block($block);

echo '
</td>'
;

if (!empty($modSettings['showright']) && !empty($context['SPortal']['blocks'][4]))
{
echo '
<td id="sp_right"'
, !empty($modSettings['rightwidth']) ? ' width="' $modSettings['rightwidth'] . '"' ''$context['SPortal']['sides'][4]['collapsed'] && empty($modSettings['sp_disable_side_collapse']) ? ' style="display: none;"' '''>';

foreach ($context['SPortal']['blocks'][4] as $block)
template_block($block);

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

function 
template_block($block)
{
global $settings;

if ($block['type'] == 'sp_boardNews')
{
$block['type']($block['parameters'], $block['id']);

return;
}

echo '
<div class="sp_block'
, !empty($block['style']['no_body']) ? '' ' tborder''">
<table class="sp_block">'
;

if (empty($block['style']['no_title']))
{
echo '
<tr>
<td class="sp_block_padding '
$block['style']['title']['class'], '"', !empty($block['style']['title']['style']) ? ' style="' $block['style']['title']['style'] . '"' '''>';

if (empty($block['force_view']))
echo '
<a class="sp_float_right" href="javascript:void(0);" onclick="sp_collapseBlock(\''
$block['id'], '\')"><img id="sp_collapse_'$block['id'], '" src="'$settings['images_url'], $block['collapsed'] ? '/expand.gif' '/collapse.gif''" alt="*" /></a>';

echo '
'
parse_bbc($block['label']), '
</td>
</tr>'
;
}

echo '
<tr'
, (empty($block['force_view']) ? ' id="sp_block_' $block['id'] . '"' '') , $block['collapsed'] && empty($block['force_view']) ? ' style="display: none;"' '''>
<td class="sp_block_padding'
, empty($block['style']['body']['class']) ? '' ' ' $block['style']['body']['class'], '"', !empty($block['style']['body']['style']) ? ' style="' $block['style']['body']['style'] . '"' '''>';

$block['type']($block['parameters'], $block['id']);

echo '
</td>
</tr>
</table>
</div>
<br />'
;
}

?>
Title: Re: Front Page Lay-out Modifications
Post by: Nathaniel on December 25, 2009, 09:05:29 PM
Try the attached file.
Title: Re: Front Page Lay-out Modifications
Post by: Shane on December 25, 2009, 09:38:54 PM
Thank you. It unfortunately does not work though. You can see my website at www.centralbarks.com and see what I mean.
Title: Re: Front Page Lay-out Modifications
Post by: Nathaniel on January 06, 2010, 06:44:12 PM
That file works perfectly for me, make sure that you are uploading it to the correct location, and overriding the old file.
SimplePortal 2.3.8 © 2008-2024, SimplePortal