jasmina
08-06-2007, 03:27 PM
How to create the additional latest news box in two columns :
1. Go to the file /include/box_definitions.php and add the code below:
$article_list = new Article_list();
$article_list->search(array('a.status' => 1, 'a.created' => $cur_date, 'a.featured_news'=> '0' ), 'order_desc', 'descending',4, 3);
$latest_news_HTML = HTML_article_list(
$article_list,
'content_article_list_no_title.tpl',
array('BOX_ID' => 'box_two_column'),
'search_result.tpl',
array('image_width' => $latest_news_image_width, 'word_number' => 20, 'columns' => 2)
);
$template_manager->assign($latest_news_HTML,'/{BOX_TWOCOL_LATEST}/');
The next line:
$article_list->search(array('a.status' => 1, 'a.created' => $cur_date, 'a.featured_news'=> '0' ), 'order_desc', 'descending',4, 3);defines the list of objects. The 'order_desc' variable defines the order of objects in the list. The latest two variables, in this example 4 and 3, show how many objects you will group by columns and from which one you will start.
The code line for the global template is:
'content_article_list_no_title.tpl', The individual template is defined with:
'search_result.tpl', In the code line:
array('image_width' => $latest_news_image_width, 'word_number' => 20, 'columns' => 2)the variable 'image_width' is used to determinate the width of the picture. The next one, 'word_number' defines the allowed number of words. You can set the number of columns, If you change the value of the 'columns' variable . For example, if you change this into 3, you will have 3 columns of articles instead of 2.
2. In the file /templates/index.tpl you need to add the tag you created:
{BOX_TWOCOL_LATEST}
1. Go to the file /include/box_definitions.php and add the code below:
$article_list = new Article_list();
$article_list->search(array('a.status' => 1, 'a.created' => $cur_date, 'a.featured_news'=> '0' ), 'order_desc', 'descending',4, 3);
$latest_news_HTML = HTML_article_list(
$article_list,
'content_article_list_no_title.tpl',
array('BOX_ID' => 'box_two_column'),
'search_result.tpl',
array('image_width' => $latest_news_image_width, 'word_number' => 20, 'columns' => 2)
);
$template_manager->assign($latest_news_HTML,'/{BOX_TWOCOL_LATEST}/');
The next line:
$article_list->search(array('a.status' => 1, 'a.created' => $cur_date, 'a.featured_news'=> '0' ), 'order_desc', 'descending',4, 3);defines the list of objects. The 'order_desc' variable defines the order of objects in the list. The latest two variables, in this example 4 and 3, show how many objects you will group by columns and from which one you will start.
The code line for the global template is:
'content_article_list_no_title.tpl', The individual template is defined with:
'search_result.tpl', In the code line:
array('image_width' => $latest_news_image_width, 'word_number' => 20, 'columns' => 2)the variable 'image_width' is used to determinate the width of the picture. The next one, 'word_number' defines the allowed number of words. You can set the number of columns, If you change the value of the 'columns' variable . For example, if you change this into 3, you will have 3 columns of articles instead of 2.
2. In the file /templates/index.tpl you need to add the tag you created:
{BOX_TWOCOL_LATEST}