How to get 4 columns of articles


Author Message
DavidH

Posted: 3/27/2011
Quote message 

Hi

I'm using Artisteer 2.6 and Joomla 1.6. I'm trying to build a template with no sidebar and I've configured the home page layout for:

0 Leading articles
4 columns
4 Intro articles

This should display the content in 4 columns across the page. Configured for 3 columns it works just fine; but when configured for 4 columns the articles are displayed in just one column the full width of the page.

Why won't the template display 4 columns?

Regards

David
 
2ninerniner2

Posted: 3/27/2011
Quote message 

Howdy -

Does it display the 4 columns properly in a non-Artisteer template? Trying this will narrow it down to J 1.6 or Artisteer.

Cheers!
Lyle
 
jennifer

Posted: 3/27/2011
Quote message 

Artisteer won't draw more than 3 columns. You have to edit the functions.php file in the positions function to make it handle more than 3 columns.

This is definitely NOT a flaw with J1.6. Artisteer hard codes 1, 2, or 3 columns and does not allow for any more than that.

 
Ian Shere

Posted: 3/27/2011
Quote message 

It's my understanding that the three column limit is for 2 sidebars and an article space, and nothing to do with the number of columns of articles within the article space. I don't believe Artisteer limits this in any way.
 
jennifer

Posted: 3/28/2011
Quote message 

Ian is partially correct, the 3 column limit that is set in functions.php does have to do with module locations and not article columns - sorry.

However, in /html/featured/default.php or /html/category/blog.php, you can't get 4 columns (in most cases) because of this
<?php if (!empty($this->intro_items)) : ?> 

<?php foreach ($this->intro_items as $key => &$item) : ?>
<?php $key = ($key - $leadingcount) + 1;
$rowcount = (((int)$key - 1) % (int)$this->columns) + 1;
$row = $counter / $this->columns;
if ($rowcount == 1) : ?>


$key is total articles on the page - (leading articles+1) + 1
$rowcount is actually the column count and if you have 4 columns and only 4 articles, $rowcount will be set to 1 by the mod function there because (4%4)+1 = 1

So you're stuck with 1 - 3 columns unless you fix this.

 
jennifer

Posted: 3/28/2011
Quote message 

Ian is partially correct, the 3 column limit that is set in functions.php does have to do with module locations and not article columns - sorry.

However, in /html/featured/default.php or /html/category/blog.php, you can't get 4 columns (in most cases) because of this
<?php if (!empty($this->intro_items)) : ?> 

<?php foreach ($this->intro_items as $key => &$item) : ?>
<?php $key = ($key - $leadingcount) + 1;
$rowcount = (((int)$key - 1) % (int)$this->columns) + 1;
$row = $counter / $this->columns;
if ($rowcount == 1) : ?>


$key is total articles on the page - (leading articles+1) + 1
$rowcount is actually the column count and if you have 4 columns and only 4 articles, $rowcount will be set to 1 by the mod function there because (4%4)+1 = 1

So you're stuck with 1 - 3 columns unless you fix this.

 
jennifer

Posted: 3/28/2011
Quote message 

actually, upon further review, I think this is limited in joomla itself - the /components/com_content/tmpl/featured/default.php has the same code in it

Of course, there is nothing stopping you from over-riding core output with your template /html files, so you could modify your /html/com_content/featured/blog.php and /html/com_content/category/default.php to allow for more than 3 columns

Take a look at a Joomla! 1.5 template for ideas on how to do that. It's not dreadfully difficult.


 
jennifer

Posted: 3/28/2011
Quote message 

I do something like this to make any number of columns:
<?php if (!empty($this->intro_items)) : ?>    

<?php $column_divs = array();
for($i=1;$i<=$this->columns;$i++) {
$column_divs[$i] = '<div class="column-' . $i . '">';
if ($i==1) {
$column_divs[$i] .= '<div class="right_pad">';
} else if ($i == $this->columns) {
$column_divs[$i] .= '<div class="left_pad">';
} else {
$column_divs[$i] .= '<div class="right_pad left_pad">';
}
}
foreach ($this->intro_items as $key => &$item) {
$key= ($key-$leadingcount)+1;
$column_count=( ((int)$key-1) % (int) $this->columns) +1;
$column_divs[$column_count] .= '<div class="item';
if ($item->state == 0) {
$column_divs[$column_count] .= ' system-unpublished';
}
$column_divs[$column_count] .= '">';
$this->item = &$item;
$column_divs[$column_count] .= $this->loadTemplate('item') . "<span class=\"row-separator\"></span></div>";
} ?>
<div class="items-row cols-<?php echo (int) $this->columns;?>">
<?php for($i=1;$i<=$this->columns;$i++) {
echo $column_divs[$i] . '</div></div>';
} ?>
</div>
<?php endif; ?>

 
zeebeest

Posted: 3/29/2011
Quote message 

Hi,
have you tried playing around with the Joomla settings 'Multi Column Order'?

This handles whether the articles are first shown all in one column and then in the next, or from left to right.


 
Roberto

Posted: 10/25/2012
Quote message 

Hi jennifer,
I've the same problem with blog columns and solved it only editing template.css. My category blog page, with 4 columns, appeared perfectly in Beez template, but not in Artisteer template. Looking at the code, with Firebug, I find a section em template.css named /* blog layout */, with only 3 columns. I added a 4th column and it works. Maybe the better way to solve it is with php, in a looping code to have other numbers of columns in blog layout.
Edited template.css:
/* template css, line 1796 */ /* blog layout */  .cols-2 .column-1, .cols-2 .column-2, .cols-3 .column-1, .cols-3 .column-2, .cols-3 .column-3, .cols-4 .column-1, .cols-4 .column-2, .cols-4 .column-3, .cols-4 .column-4 {    float: left;    clear: right; }  .cols-2 .column-1 {    width: 50%; } .cols-2 .column-2 {    width: 50%; } .cols-3 .column-1 {    width: 33%; } .cols-3 .column-2 {    width: 33%; } .cols-3 .column-3 {    width: 34%; } .cols-4 .column-1 {    width: 25%; } .cols-4 .column-2 {    width: 25%; } .cols-4 .column-3 {    width: 25%; } .cols-4 .column-3 {    width: 25%; } .row-separator {    clear: both;    float: none;    font-size: 1px;    display: block; }