Subject: Split up the index items in 2 columns

Posted on: 09/03/2004 07:06am
By: bloc

Recently a friend of mine wanted to start using Geeklog, and asked if it was possible to have 2 columns instead of just the one on the index-page.

Well, I made a hack to mimic that, since geeklog doesn't seem to support multiple columns...Its very basic, just 2 columns where "featured" gets on top in the left column and the rest follows left - right column.
Perhaps someone might find a use for it.

Since my friend didn't want "featured" to be just 1 column I left that one out...but it is easy to add back in again.

The changes are made in public_html/index.php

$data = DB_query ("SELECT COUNT(*) AS count " . $sql);
$D = DB_fetchArray ($data);
$num_pages = ceil ($D['count'] / $limit);
 
// between here the changes are made

if ($nrows > 0) {
$half=ceil($nrows/2);
$rest=$nrows-$half;
$display .= '<table border="0" width="100%" cellpadding="3" cellspacing="0"><tr><td valign="top"';
if ($rest <=0) { $display .=' width="100%"';} else {$display .=' width="50%"';}
$display .= '>';
  for ($x = 1; $x <= $half; $x++) {
        $A = DB_fetchArray($result);
        if ($A['featured'] == 1) {
            $feature = 'true';
        } elseif (($x == 1) && ($_CONF['showfirstasfeatured'] == 1)) {
            $feature = 'true';
            $A['featured'] = 1;
        } 
       $display .= COM_article($A,'y');
   }
$display .= '</td>';
if ($rest>0)
   {$display .= '<td width="50%" valign="top">';
       for ($x = $half+1; $x <= $nrows; $x++) {
        $A = DB_fetchArray($result);
        $display .= COM_article($A,'y');
       }
		    $display .= '</td>';
		}

$display .= '</tr></table>';

// between here the changes are made

    $display .= PLG_showCenterblock (3, $page, $topic); // bottom blocks



Split up the index items in 2 columns

Posted on: 04/08/2004 01:47pm
By: Anonymous

THIS ROCKS!

i came here looking for precisely this and it works great.

thanks for the hack
greenhil

Split up the index items in 2 columns

Posted on: 07/11/2004 08:57pm
By: Euan

Here's another one that uses templates and puts the featured article in across both columns (index.php included is from 1.3.10rc2).

Cheers,

Euan.

Re: Split up the index items in 2 columns

Posted on: 27/09/2008 02:46pm
By: koalasoft

Quote by: euan

<a href="http://www.heatherengineering.com/staticpages/index.php/in.columns.en">Here's another one</a> that uses templates and puts the featured article in across both columns (index.php included is from 1.3.10rc2).

Cheers,

Euan.




Access to this page is denied. Either the page has been moved/removed or you do not have sufficient permissions. Cry

Geeklog - Forum
https://www.geeklog.net/forum/viewtopic.php?showtopic=31684