Status: offline

usarfans

Forum User
Junior
Registered: 10/08/03
Posts: 34
cordiste,

The code you provided to reorder the two columns chronology worked well. Thank you!

I did make two minor changes. The first one was to comment out the line that lined up the top of the stories. For my site it caused too much blank white space for my taste.

The second change added an extra <br> after the articles and before the plugin centerblocks, mostly just for my personal preference.

Thanks again. I have not tried the optional method of using story1, story2, etc. Didn't want to push my luck with editing two files :-)

Lou

Status: offline

::Ben

Forum User
Full Member
Registered: 14/01/05
Posts: 1569
And if you need three columns

PHP Formatted Code

.story3 , .story5, .story7, .story9, .story11, .story13, .story15, .story2, .story4, .story6, .story8, .story10, .story12, .story14, .story16{
  float:left;
  width:31%;
  padding:10px 15px 10px 0px;
  background:transparent;
  color:#000000;
}
 


::Ben
I'm available to customise your themes or plugins for your Geeklog CMS

Status: offline

::Ben

Forum User
Full Member
Registered: 14/01/05
Posts: 1569
Yes it is working Smile

This is storytext.thtml
PHP Formatted Code

<div class="story{story_counter}">
    <span class="story-icons">
        {email_icon}
        {print_icon}
        {pdf_icon}
        {edit_icon}
    </span>
    <h1>{story_title_link}</h1>
    <div class="story-information">
        <p>{story_date}</p>
        <p>{lang_contributed_by} {start_contributedby_anchortag}{contributedby_author}{end_contributedby_anchortag}</p>
        <p>{lang_views} {story_hits}</p>
    </div>
    <div class="story-body">
        {story_anchortag_and_image}{story_text_no_br}
    </div>
    <div class="story-footer">
        <p>{page_selector}</p>
        <p>{readmore_link} {post_comment_link}</p>
        <p>{plugin_itemdisplay}{comments_with_count} {trackbacks_with_count}</p>
    </div>
</div>


and new classes in style.css

PHP Formatted Code

.story3 , .story5, .story7, .story9, .story11, .story13, .story15{
  float:left;
  width:48%;
  padding:10px 10px 10px 0px;
  background:transparent;
  color:#000000;
}
.story2, .story4, .story6, .story8, .story10, .story12, .story14, .story16{
  float:left;
  width:48%;
  padding:10px 10px 10px 0px;
  background:transparent;
  color:#000000;
}


If you wish to add content after the stories make a staticpage starting with

PHP Formatted Code
<div style="clear:both;"></div>


::Ben
I'm available to customise your themes or plugins for your Geeklog CMS

Status: offline

Dirk

Site Admin
Admin
Registered: 12/01/02
Posts: 13073
Just curious: Has anyone tried using the {story_counter} variable? It's increased for every story (0 for the featured story, 1 for the first, 2 for the second, and so on). I was wondering if you could use something like class="story{story_counter}" (and CSS classes like story0, story1, etc.) to produce a two-column layout without any actual code changes?

bye, Dirk

Status: offline

usarfans

Forum User
Junior
Registered: 10/08/03
Posts: 34
Quote by: cordiste

@usarfans

Are you looking for something like this one?
::Ben



I'll try it out tonight and let you know! Thanks for the very fast reply!

Lou

Status: offline

::Ben

Forum User
Full Member
Registered: 14/01/05
Posts: 1569
Hello,

@KunfuBeer

Counts were here to test, it is cleaner to remove them on a productive site Wink

@usarfans

Are you looking for something like this one?

PHP Formatted Code

    // get remaining stories
       
        $storycount = 2;
       
    while ($A = DB_fetchArray ($result)) {
        $story = new Story();
        $story->loadFromArray($A);
                if (($storycount) % 2 == 0)
        {
           $display .= '<div id="columnleft" style="float:left; width:48%;padding-right:10px;">';
                   $display .= STORY_renderArticle ($story, 'y');
                   $display .= '</div>';
        }
           else
        {
           $display .= '<div id="columnright" style="float:right; width:48%;padding-right:10px;">';
                   $display .= STORY_renderArticle ($story, 'y');
                   $display .= '</div>';
                   // Comment out this next line if you do not need horizontal alignment 2 stories by 2
                   $display .= '<div style="clear:both"></div>';
        }
                $storycount ++;
                 

    }        
        $display .= '<div style="clear:both"></div>';
                       
    // get plugin center blocks that follow articles


::Ben
I'm available to customise your themes or plugins for your Geeklog CMS

Status: offline

usarfans

Forum User
Junior
Registered: 10/08/03
Posts: 34
cordiste provided a wonderful and easy to implement solution for two columns on the main page. It's working well for me as too but I have one question. Can the code be modified so that the chronology of the articles displayed is changed? With cordiste's code, the left column takes the first 5 stories based on date, after the feature story, and puts them in the left column. It then goes back to the to top and the right column and puts the remaining articles. They are arranged like this:
PHP Formatted Code

Left              Right
April 10        April 5
April 9         April 4
April 8         April 3
April 7         April 2
April 6         April 1
 
It looks nice but I was wondering if a change could be made to have the articles alternate left -- right -- left -- right, etc. based on date of the article so the most recent are always on top of other articles. Like this:
PHP Formatted Code

Left              Right
April 10        April 9
April 8         April 7
April 6         April 5
April 4         April 3
April 2         April 1
 
Does this make sense? I did my best to look at the code and see if I could do it myself, but quite frankly, I'm just not smart enough! Thanks for any thoughts on the matter. Lou

Status: offline

KungfuBeer

Forum User
Newbie
Registered: 11/01/06
Posts: 14
Quote by: cordiste

William,

This hack is working. Maybe you will have to theme the divs.

In index.php near line 317

PHP Formatted Code

    // get remaining stories
       
        $storycount = 2;
        $limit = 1+((int)($nrows/2));
               
        $display .= '<div id="columnleft" style="float:left; width:48%;padding-right:10px;">';
               
    while ($A = DB_fetchArray ($result)) {
        //$display .= $storycount . "/" . $nrows . ' ' . $limit;
        $story = new Story();
        $story->loadFromArray($A);
        $display .= STORY_renderArticle ($story, 'y');
        if ($storycount >= $limit)
                    break;
        $storycount++;
    }
        $display .= '</div>';
        $display .= '<div id="columnright" style="float:right; width:48%;padding-right:10px;">';
               
    while ($A = DB_fetchArray ($result)) {
        //$display .= $storycount . "/" . $nrows;
        $story = new Story();
        $story->loadFromArray($A);
        $display .= STORY_renderArticle ($story, 'y');
        $storycount++;
    }

        $display .= '</div><div style="clear:both"></div>';
                       
    // get plugin center blocks that follow articles


::Ben



This works great!!! Thanks for the code!

I did comment out both of these, so the story count does not show.
PHP Formatted Code
$display .= $storycount . "/" . $nrows . ' ' . $limit;

Status: offline

::Ben

Forum User
Full Member
Registered: 14/01/05
Posts: 1569
Hello,

That looks like a great hack Big Grin


Just a little one Smile

I'm working to a new plugin call "Blocks plugin" witch allow to replace content by a block... and in a block you can put a hack. So this hack would be available if you need it.

I'm looking for some cool old php blocks and will add them to this Blocks manager plugin. There will be a place for this one too before the next media gallery release.

Maybe it's a good way to allow hacks without hacking the core.

::Ben
I'm available to customise your themes or plugins for your Geeklog CMS

Status: offline

koalasoft

Forum User
Full Member
Registered: 09/03/05
Posts: 242
Working .. perflectly

Super perfecto .. !!

Thank's Cordise !!

Grettings !!
**Cuando el Alumno esta listo, el Maestro Aparece ** ::Geeklog support in Spanish::

Status: offline

beewee

Forum User
Full Member
Registered: 05/08/03
Posts: 969
That looks like a great hack Big Grin . Is a featured article still full width? When yes, this would be nice to make this a standard feature for GL 1.52. I'm no developer Mr. Green , but I'm sure there is a way to put this in the config. options.
Dutch Geeklog sites about camping/hiking: www.kampeerzaken.nl | www.campersite.nl | www.caravans.nl | www.caravans.net

Zmxn

Anonymous
Quote by: cordiste

William,

This hack is working. Maybe you will have to theme the divs.

In index.php near line 317


::Ben



Thank you, Cordiste! It work great in GL 1.5.1. But can you made code that will working in GL 1.4.1 or what I need to do that it works? thank you

Status: offline

::Ben

Forum User
Full Member
Registered: 14/01/05
Posts: 1569
William,

This hack is working. Maybe you will have to theme the divs.

In index.php near line 317
PHP Formatted Code

    // get remaining stories
       
        $storycount = 2;
        $limit = 1+((int)($nrows/2));
               
        $display .= '<div id="columnleft" style="float:left; width:48%;padding-right:10px;">';
               
    while ($A = DB_fetchArray ($result)) {
        $display .= $storycount . "/" . $nrows . ' ' . $limit;
        $story = new Story();
        $story->loadFromArray($A);
        $display .= STORY_renderArticle ($story, 'y');
        if ($storycount >= $limit)
                    break;
        $storycount++;
    }
        $display .= '</div>';
        $display .= '<div id="columnright" style="float:right; width:48%;padding-right:10px;">';
               
    while ($A = DB_fetchArray ($result)) {
        $display .= $storycount . "/" . $nrows;
        $story = new Story();
        $story->loadFromArray($A);
        $display .= STORY_renderArticle ($story, 'y');
        $storycount++;
    }

        $display .= '</div><div style="clear:both"></div>';
                       
    // get plugin center blocks that follow articles


::Ben
I'm available to customise your themes or plugins for your Geeklog CMS

Status: offline

::Ben

Forum User
Full Member
Registered: 14/01/05
Posts: 1569
Michael (sorry for my late response),

To replace the normal content by another in the index page and because it's not only a variable, a easy way is to get code from a hack, a static page or a plugin.

functions.php in the template folder is more for content order and template variables.

::Ben
I'm available to customise your themes or plugins for your Geeklog CMS

Status: offline

::Ben

Forum User
Full Member
Registered: 14/01/05
Posts: 1569
Hi,

Another idea, if your don't want to hack the index.php file, is to make a plugin and with the function PLG_showCenterblock you could replace the entire index page.

::Ben


I'm available to customise your themes or plugins for your Geeklog CMS

ironmax

Anonymous
Quote by: cordiste

Hi Koalasoft,

With a hack of the index.php you could enclose the render of the first half of the stories in a div (float left and width 50%) witch will display stories on the left and for the second half another div for stories on the right.

If you have 6 stories per pages:
for story 1 to 3 > display left
for story 4 to 6 > display right

Like this, every page (page=1, page=2... topic=1, topic=2...) will be 2 colons like on Joomla.

::Ben



I wonder, could it be possible to use a variable in place of the hack you made above and place the changes in the functions.php file of the theme? Cuz then this could go a long ways. All the admin would have to do is just change out that index file or make the changes in it. Then theme devs could program for that in the themes.

Just my :twocents: worth

Michael

Status: offline

::Ben

Forum User
Full Member
Registered: 14/01/05
Posts: 1569
Hi Koalasoft,

With a hack of the index.php you could enclose the render of the first half of the stories in a div (float left and width 50%) witch will display stories on the left and for the second half another div for stories on the right.

If you have 6 stories per pages:
for story 1 to 3 > display left
for story 4 to 6 > display right

Like this, every page (page=1, page=2... topic=1, topic=2...) will be 2 colons like on Joomla.

::Ben
I'm available to customise your themes or plugins for your Geeklog CMS

Status: offline

hfd

Forum User
Junior
Registered: 19/06/08
Posts: 16
Quote by: koalasoft

Good… this example is good, but it is not what I look for, I put as it in the image, I want to see if there is the possibility that the articles in the main page appear in the form of columns to the Joomla style but that is made automatically.

Grettings !! Mr. Green


I think Geeklog can't do that way. because joomla and geeklog are difference code, form and much more. what you looking for is a new rebuild geeklog. I guess geeklog have to do some thing difference from joomla. they will not follow joomla style any way.

if you really what to use geeklog as the way joomla do. I think you have to pay for a programmer to rebuild geeklog as joomla for you. (my opinion).

I am waiting to see Geeklog 2 to see how the look.

thanks.

Status: offline

koalasoft

Forum User
Full Member
Registered: 09/03/05
Posts: 242
Good… this example is good, but it is not what I look for, I put as it in the image, I want to see if there is the possibility that the articles in the main page appear in the form of columns to the Joomla style but that is made automatically.

Grettings !! Mr. Green
**Cuando el Alumno esta listo, el Maestro Aparece ** ::Geeklog support in Spanish::

Status: offline

hfd

Forum User
Junior
Registered: 19/06/08
Posts: 16
how about create a static page and set to featured with no right block. insert the news menully in the table.

PHP Formatted Code

<table border="0" height="160" width="550" align="center">
<tr>
<th><center>Page 1 title</center></th>
<th><center>Page 2 title</center></th>
</tr>
<tr>
<td bgcolor="#ff9966" valign=top>
<ul><li>put your first news here.
<li>feature news 2.
<li>feature news 3.
<li><a href="http://yoursite.com/staticpages/index.php?page=2008101714094xxxx">feature news 3</a>
<li>news tible 4.
<li><a href="http://yoursite.com/staticpages/index.php?page=200810171354xxxx">news tible here</a>
</td>
<td bgcolor="#99CC33" valign=top>
<ul><li>Myspace
<li>Yahoo
<li>Google
<li>Window Live
<li>Your page2
<li>Your page3
</td>
</tr>
</table>