Keyword

K2 category blog layout as com_content blog

  • Teno Sinh
  • Teno Sinh's Avatar Topic Author
  • Offline
  • New Member
More
12 years 1 month ago #102312 by Teno Sinh
please tell me how I will I change K2 blog layout as joomla com_content blog layout.
I need to change k2 layout as com_content like column.
please convert this code for k2


<?php
if ($count = count($this->intro_items)) :

// init vars
$rows = ceil($count / $this->params->get('num_columns', 2));
$columns = array();
$row = 0;
$column = 0;
$i = 0;

// create intro columns
foreach ($this->intro_items as $item) {
if ($this->params->get('multi_column_order', 1) == 0) {
// order down
if ($row >= $rows) {
$column++;
$row = 0;
$rows = ceil(($count - $i) / ($this->params->get('num_columns', 2) - $column));
}
$row++;
} else {
// order across
$column = $i % $this->params->get('num_columns', 2);
}

if (!isset($columns[$column])) {
$columns[$column] = '';
}

$this->item =& $item;
$columns[$column] .= $this->loadTemplate('item');
$i++;
}
// render intro columns
if ($count = count($columns)) {
echo '<div class="items-row cols-'.$count.' clearfix">';
for ($i = 0; $i < $count; $i++) {
$first = ($i == 0) ? ' first' : null;
$last = ($i == $count - 1) ? ' last' : null;
echo '<div class="item column-'.($i+1).'"><div class="item-inner '.$first.$last.' clearfix">'.$columns[$i].'</div></div>';
}
echo '</div>';
}

endif;
?>

Please Log in or Create an account to join the conversation.

More
12 years 1 month ago #102313 by william white
Replied by william white on topic Re: K2 category blog layout as com_content blog
It may be a good idea to take a look at this video
getk2.org/documentation/k2class2012/item/860-setting-up-a-basic-blog
before starting to change the php
Take a look at all the settings in the category and turn things off you do not want to show.
Later, take a look at the last two videos that will show you how to override the default k2 layout and there is the best place to make changes to the code

Please Log in or Create an account to join the conversation.

  • Teno Sinh
  • Teno Sinh's Avatar Topic Author
  • Offline
  • New Member
More
12 years 1 month ago #102314 by Teno Sinh
Replied by Teno Sinh on topic Re: K2 category blog layout as com_content blog
William thanks for replay. but your reply did'nt solved anything.
Please tell me how will i change the php code.
cause I am making a template for k2, but there is problem.
Please give the code :-)

Please Log in or Create an account to join the conversation.

More
12 years 1 month ago #102315 by william white
Replied by william white on topic Re: K2 category blog layout as com_content blog
it would much eaiser to start with the original k2 layouts
In the category settings
set leading to 0
Set secondary to 0
set primary to the number of items you want displayed, and columns there to the desired number of columns
hide all unwanted elements in the view your working with
and then use the override to customize the rest.
Starting with the original K2 code will make it much easier and the result will affect only the category that you have your override set to
Work with category_item.php and item.php first and after reading the code you will see how k2 handles things and then if you wish you can make your own code

Please Log in or Create an account to join the conversation.


Powered by Kunena Forum