By associate on
I need a view creating that is 2 column lists kind of like the 'panels: treaser, 2 columns' view but I need to customize it some what which I'm unable todo.
As you will see in the image there's the thumbnail image then a arrow bullet and then teaser text which is clickable.
I have some code already but needs finishing below. Can you let me know how much this would cost to achieve this.
Regards
Brad
function phptemplate_views_view_list_two_column($view, $nodes, $type) {
$fields = _views_get_fields();
$taken = array();
// Set up the fields in nicely named chunks.
foreach ($view->field as $id => $field) {
$field_name = $field['field'];
if (isset($taken[$field_name])) {
$field_name = $field['queryname'];
}
$taken[$field_name] = true;
$field_names[$id] = $field_name;
}
// Set up some variables that won't change.
$base_vars = array(
'view' => $view,
'view_type' => $type,
);
foreach ($nodes as $i => $node) {
$vars = $base_vars;
$vars['node'] = $node;
$vars['count'] = $i;
$vars['stripe'] = $i % 2 ? 'even' : 'odd';
foreach ($view->field as $id => $field) {
$name = $field_names[$id];
$vars[$name] = views_theme_field('views_handle_field', $field['queryname'], $fields, $field, $node, $view);
if (isset($field['label'])) {
// $vars[$name . '_label'] = $field['label'];
}
if ($field_names[$id] == 'field_image_field_fid') {
$vimage .= $vars[$name];
}
if (!($field_names[$id] == 'field_image_field_fid')) {
$vfields .= $vars[$name];
}
//kd $temp .= '<div class="view-field view-data-title">' . $vars[$name] . '</div>';
}
$temp = '<div class="view-image">' . $vimage . '</div>' . '<div class="view-fields">' . $vfields . '</div>';
$vimage = '';
$vfields = '';
$items[] = $temp;
$temp = '';
}
$total_items = count($items);
$iindex = floor($total_items / 2);
$iarg = (2 == 1) ? $iarg = -1 : $iarg = 0;
$items1 = array_slice($items, 0, $iindex + $iarg);
$items2 = array_slice($items, $iindex);
if ($items) {
return '<div class="two-columns">' . theme('item_list2', $items1) . theme('item_list2', $items2) . '</div>';
}
}
function phptemplate_item_list2($items = array(), $title = NULL, $type = 'ul', $attributes = NULL) {
// $output = '<div class="item-list">';
static $cc = 0;
$cc++;
if (isset($title)) {
$output .= '<h3>'. $title .'</h3>';
}
if (!empty($items)) {
$output .= "<$type" . ' class="column-' . $cc . '"' . drupal_attributes($attributes) . '>';
foreach ($items as $item) {
$attributes = array();
$children = array();
if (is_array($item)) {
foreach ($item as $key => $value) {
if ($key == 'data') {
$data = $value;
}
elseif ($key == 'children') {
$children = $value;
}
else {
$attributes[$key] = $value;
}
}
}
else {
$data = $item;
}
if (count($children) > 0) {
$data .= theme_item_list($children, NULL, $type, $attributes); // Render nested list
}
$output .= '<div>';
$output .= '<li' . drupal_attributes($attributes) . '>'. $data .'</li>';
$output .= '<span class="clear"></span></div>';
}
$output .= "</$type>";
}
// $output .= '</div>';
return $output;
}