SimplePortal
Customization => Custom Coding => Topic started by: ZombieBobie on April 28, 2013, 06:38:00 PM
-
Hello!
I'm trying to find a way to make board news (basically parsing a forum news board) into a format like this:
Newspost1 | Newspost2 | Newspost 3
Newspost4 | Newspost5 | Newspost 6
I've tried with the block in blocks ( http://simpleportal.net/index.php?topic=5332.20 ), but I haven't been able to get the posts separated the way I want them to be separated.
I'm attempting to make something similar to the layout here: http://themittani.com/
Any help would be appreciated.
-
this code is my code to how my shoutbox and unread posts in 1 block you can modify it to do what u want
echo '<TABLE width=50% align= right>
<TR bgcolor="transparent"><TH align= left><h4 class="catbg">Shoutbox</h4></TH></TR>
<TR bgcolor="#111111"> <TD>';
$params['shoutbox'] = 2; // Your shoutbox ID
sp_shoutbox($params, 0);
echo '</TD></TABLE>';
echo '<TABLE width=50% align= right>
<TR bgcolor="transparent"> <TH align= left><h4 class="catbg">Unread Posts</h4></TH></TR>
<TR bgcolor="#111111"> <TD>';
global $sourcedir;
@require_once($sourcedir . '/PortalUnread.php');
/* Basic settings */
$parameters['type'] = 'Posts'; /* Posts/Topics */
$parameters['limit'] = 200; /* (int) Maximum amount of posts/topics to display */
$parameters['rows'] = '10'; /* (int) Amount of posts/topics per page */
$parameters['display'] = 'full'; /* full/compact */
/* Language Text */
$parameters['prev'] = 'Prev';
$parameters['next'] = 'Next';
$id = false;
sportal_unread($parameters, $id, $return_parameters = false);
echo '</TD></TABLE>';
attached preview
-
I'm able to format it into columns, but I haven't found a way to extract the posts so that it goes:
Post 1 | Post 2 | Post 3
Post 4 | Post 5 | Post 6
Thanks though Ares, I got two ways of making columns now :)
-
Well, it took a lot of fiddling.
But I got it to a decent level at least:
http://www.moxguild.com/
Thanks a lot to the people at: http://simpleportal.net/index.php?topic=5248.0;nowap
Now to convert it into dynamic resizing for tablets etc. I guess the table could be replaced ...
-
ZombieBobie,
Dynamic means using javascript to alter the html after the page loads. There is no need for that as you can just use a table with 3 per row and use css for the cell widths.
ie.
$count = 0;
echo '
<table style="width:100%">
<tr>';
foreach ($posts as $post)
{
$count++;
echo '
<td style="width:33%">
', $post, '
</td>';
if ($count == 3)
{
$count = 0;
echo '
</tr>
<tr>';
}
}
for ($i=$count; $i>0 && $i<=3; $i++)
echo '
<td style="width=33%;">
</td>';
echo '
</tr>
</table>';
If you can not guarantee at least 1 post then perhaps this would be wiser:
$count = 0;
if (!empty($posts))
{
echo '
<table style="width:100%">
<tr>';
foreach ($posts as $post)
{
$count++;
echo '
<td style="width:33%">
', $post, '
</td>';
if ($count == 3)
{
$count = 0;
echo '
</tr>
<tr>';
}
}
for ($i=$count; $i>0 && $i<=3; $i++)
echo '
<td style="width=33%;">
</td>';
echo '
</tr>
</table>';
}
else
echo '
<span style="text-align:center;">
There are no new posts to view.
</span>';
-
hey Underdog.. even i was looking for somthing like this.. can you suggest me how can i have row and column in recent attachment block?????