View Full Version : Category - 2 Columns
PaulSmith
09-16-2006, 01:56 PM
Hey All
I have used this hack:
http://www.vivvo.net/forums/showthread.php?t=243
and am now able to have my latest articles in 2 columns which looks great. The obvious problem now though is, as im using images on every article - the category page looks dreadfull with just one column.
Can someone help me to get the main category pages to have 2 columns as well please.
Thanks!
Paul
PaulSmith
09-20-2006, 09:49 PM
Anyone?
Boccio as you posted the original hack I was kind of hoping you'd have something to contribute?
boccio
09-30-2006, 08:51 AM
We're preparing a minor version release that will address this issue as well.
ironAlex
09-30-2006, 01:18 PM
There are simple hack on index.php.
Find line 191 (approximate, to $article=new Article(); ) and replace next code block
if ($category->PostedArticles>0)
$show_pager_HTML=HTML_Show_Pager($page_num, $cur_page, $pg_link);
$col_no = 2;
$cur_col = 0;
while ($row=mysql_fetch_array($result))
{
$cur_col++;
if ($cur_col==1){
$category_articles_short_HTML.='<tr>';
}
$category_articles_short_HTML.='<td valign="top">';
$article=new Article();
Find line 252 (approximate, to $category_articles_short_HTML.='</table>'; ) and replace next code block
$category_articles_short_HTML.=preg_replace($patte rn, $replacement, $subject);
if ($cur_col==$col_no){
$category_articles_short_HTML.='</td></tr>';
$cur_col = 0;
} else {
$category_articles_short_HTML.='</td>';
}
} // while articles in category
if ($cur_col!=$col_no) $category_articles_short_HTML.='</tr>';
$category_articles_short_HTML.='</table>';
zwenthe
05-12-2007, 12:40 AM
Is there a way to do this in 3.5
chaichai21
05-12-2007, 11:35 PM
i am also looking to include the same also..
zwenthe
05-14-2007, 05:46 PM
I've been playing with this to no luck. Anybody get any closer to solving this?
boccio
05-14-2007, 08:53 PM
Latest news in 2 columns in v3.5?
This is typical example of formating article list (output) in 3.5 template engine. For the start, please refer to the List Them Articles (http://www.vivvo.net/forums/showthread.php?t=674) thread to get acquainted with generating (and modifying) article output lists.
Locate /include/box/ to find all the output lists, and "Latest News" is actually /include/box/HTML_article_list.php file. "Headlines" is /include/box/HTML_featured_news.php, etc...
When you open HTML_article_list.php, look for function parameters at the very beginning of the file (comments area). In particular:
* @example array('word_number' => 40, 'image_width' => 0, 'image_height' => 0, 'columns' => 1, ...)
So, all you need to do is format article output to 'columns' =>2, or whatever you want...
Hope this helps
chaichai21
05-15-2007, 06:27 PM
hi guys, did anyone get this working ??
So i figured that on index.php (on line 565) around this part you can manipulate this below based on what instructions were given above..
$latest_news_HTML = HTML_article_list(
$article_list,
'content_article_list.tpl',
array('BOX_TITLE' => $latest_news_title, 'BOX_ID' => 'box_article_list'),
'article_short.tpl',
array('image_width' => $latest_news_image_width, 'word_number' => $latest_news_word_number, 'columns' => $frontend_latest_news_columns)
);
But does anyone know where you can do this for the actual category view. I mean if u wanna put each category into 2 columns? So it would be under Category view and not latest news function
zwenthe
05-15-2007, 07:50 PM
in include/box/html_article_list.php
Add:
$article_params['columns'] =X;
Where x is the number of columns you want
right above
$article_params['columns'] = intval($article_params['columns']);
if ($article_params['columns'] > 1){
$box_width = (floor(100 / $article_params['columns']) - 1) . '%';
}else{
$box_width = '100%';
}
That should make your columns work
chaichai21
05-16-2007, 01:18 AM
hi thanks,,
ok now i understand this - - you see the issue is that in include/box/HTML_article_list.php its sets a global variable for all category display sections on front page or in more news or in the latest news. Once you put in that parameter then everyting site-wide changes...
Now what the script does not have is a function for viewing each catgory - i mean i know each catgory can have its own unique template, but the display of that template is still called by HTML_article_list.php, which defines how amny columns and so on to use...
I think if HTML_article_list.php, could have a function written in it to let the categories www.domain.com/category1/ display their articles differently..
And then again maybe it has it, but hey ia m a bit slower than you guys :)
zwenthe
05-16-2007, 03:54 AM
Now that you say, that it is probably a global variable, I don't use them more news or latest news on my site... so I never noticed.
Is it possible to set the option global and then override it... it may be possible. Maybe UTVARA can chime in.
vBulletin® v3.8.4, Copyright ©2000-2012, Jelsoft Enterprises Ltd.