Drupal views pane content not visible
Posted
by jwandborg
on Stack Overflow
See other posts from Stack Overflow
or by jwandborg
Published on 2010-04-08T11:53:26Z
Indexed on
2010/04/08
12:03 UTC
Read the original article
Hit count: 817
I have a pane on my front page with one content pane and two views panes.
I can't see the content of the third view ($pane->pid = "new-3"
/ comment: # Senaste bilder
).
Here's my panel
<?php
$page = new stdClass;
$page->disabled = FALSE; /* Edit this to true to make a default page disabled initially */
$page->api_version = 1;
$page->name = 'frontpage';
$page->task = 'page';
$page->admin_title = 'Startsida';
$page->admin_description = '';
$page->path = 'hem';
$page->access = array();
$page->menu = array();
$page->arguments = array();
$page->conf = array();
$page->default_handlers = array();
$handler = new stdClass;
$handler->disabled = FALSE; /* Edit this to true to make a default handler disabled initially */
$handler->api_version = 1;
$handler->name = 'page_frontpage_panel_context';
$handler->task = 'page';
$handler->subtask = 'frontpage';
$handler->handler = 'panel_context';
$handler->weight = 0;
$handler->conf = array(
'title' => 'Panel',
'no_blocks' => FALSE,
'css_id' => '',
'css' => '',
'contexts' => array(),
'relationships' => array(),
);
$display = new panels_display;
$display->layout = 'onecol';
$display->layout_settings = array();
$display->panel_settings = array();
$display->cache = array();
$display->title = '';
$display->content = array();
$display->panels = array();
# Bild
$pane = new stdClass;
$pane->pid = 'new-1';
$pane->panel = 'middle';
$pane->type = 'custom';
$pane->subtype = 'custom';
$pane->shown = TRUE;
$pane->access = array();
$pane->configuration = array(
'admin_title' => '',
'title' => '',
'body' => '<img src="/sites/all/themes/zen/ils-2010/img/graphics-start-text-v3.png" alt="Hej! Vi vet att du och dina klasskompisar har mycket att tänka på under er sista termin i gymnasiet. Därför har vi samlat några saker som vi tror kommer göra er studenttid lite roligare och lite enklare. Välkommen!" />',
'format' => '2',
'substitute' => TRUE,
);
$pane->cache = array();
$pane->style = array();
$pane->css = array();
$pane->extras = array();
$pane->position = 0;
$display->content['new-1'] = $pane;
$display->panels['middle'][0] = 'new-1';
# Topplista
$pane = new stdClass;
$pane->pid = 'new-2';
$pane->panel = 'middle';
$pane->type = 'views_panes';
$pane->subtype = 'topplista_terms-panel_pane_1';
$pane->shown = TRUE;
$pane->access = array();
$pane->configuration = array(
'link_to_view' => 1,
'more_link' => 0,
'use_pager' => 0,
'pager_id' => '',
'items_per_page' => '10',
'offset' => '0',
'path' => 'flaktavling/topplista/klasser',
'override_title' => 0,
'override_title_text' => '',
);
$pane->cache = array();
$pane->style = array();
$pane->css = array();
$pane->extras = array();
$pane->position = 1;
$display->content['new-2'] = $pane;
$display->panels['middle'][1] = 'new-2';
# Senaste bilder
$pane = new stdClass;
$pane->pid = 'new-3';
$pane->panel = 'middle';
$pane->type = 'views_panes';
$pane->subtype = 'senaste_bilderna-panel_pane_1';
$pane->shown = TRUE;
$pane->access = array();
$pane->configuration = array(
'link_to_view' => 0,
'more_link' => 0,
'use_pager' => 0,
'pager_id' => '',
'items_per_page' => '2',
'offset' => '0',
'path' => 'galleri/senaste-bilder',
'override_title' => 0,
'override_title_text' => '',
);
$pane->cache = array();
$pane->style = array();
$pane->css = array(
'css_id' => 'pane-senaste-bilderna',
'css_class' => '',
);
$pane->extras = array();
$pane->position = 2;
$display->content['new-3'] = $pane;
$display->panels['middle'][2] = 'new-3';
$display->hide_title = PANELS_TITLE_FIXED;
$display->title_pane = 'new-1';
$handler->conf['display'] = $display;
$page->default_handlers[$handler->name] = $handler;
Here´s the view senaste_bilderna
<?php
$view = new view;
$view->name = 'senaste_bilderna';
$view->description = '';
$view->tag = '';
$view->view_php = '';
$view->base_table = 'node';
$view->is_cacheable = FALSE;
$view->api_version = 2;
$view->disabled = FALSE; /* Edit this to true to make a default view disabled initially */
$handler = $view->new_display('default', 'Förvalt', 'default');
$handler->override_option('fields', array(
'field_picture_fid' => array(
'id' => 'field_picture_fid',
'table' => 'node_data_field_picture',
'field' => 'field_picture_fid',
),
));
$handler->override_option('sorts', array(
'created' => array(
'order' => 'DESC',
'granularity' => 'second',
'id' => 'created',
'table' => 'node',
'field' => 'created',
'relationship' => 'none',
),
));
$handler->override_option('filters', array(
'type' => array(
'operator' => 'in',
'value' => array(
'ils_picture' => 'ils_picture',
),
'group' => '0',
'exposed' => FALSE,
'expose' => array(
'operator' => FALSE,
'label' => '',
),
'id' => 'type',
'table' => 'node',
'field' => 'type',
'override' => array(
'button' => 'Åsidosätt',
),
'relationship' => 'none',
),
));
$handler->override_option('access', array(
'type' => 'none',
));
$handler->override_option('cache', array(
'type' => 'none',
));
$handler->override_option('title', 'Senaste bilderna från galleriet');
$handler->override_option('items_per_page', 2);
$handler->override_option('row_options', array(
'inline' => array(
'field_picture_fid' => 'field_picture_fid',
),
'separator' => '',
'hide_empty' => 0,
));
$handler = $view->new_display('panel_pane', 'Content pane', 'panel_pane_1');
$handler->override_option('pane_title', '');
$handler->override_option('pane_description', '');
$handler->override_option('pane_category', array(
'name' => 'View panes',
'weight' => 0,
));
$handler->override_option('allow', array(
'use_pager' => FALSE,
'items_per_page' => FALSE,
'offset' => FALSE,
'link_to_view' => FALSE,
'more_link' => FALSE,
'path_override' => FALSE,
'title_override' => FALSE,
'exposed_form' => FALSE,
));
$handler->override_option('argument_input', array());
$handler->override_option('link_to_view', 0);
$handler->override_option('inherit_panels_path', 0);
$handler = $view->new_display('page', 'Sida', 'page_1');
$handler->override_option('path', 'galleri/senaste-bilderna');
$handler->override_option('menu', array(
'type' => 'none',
'title' => '',
'description' => '',
'weight' => 0,
'name' => 'navigation',
));
$handler->override_option('tab_options', array(
'type' => 'none',
'title' => '',
'description' => '',
'weight' => 0,
));
I have edited one views template, here's the code in the file views-view-fields--senaste-bilderna.tpl.php
<?php
// $Id: views-view-fields.tpl.php,v 1.6 2008/09/24 22:48:21 merlinofchaos Exp $
/**
* @file views-view-fields.tpl.php
* Default simple view template to all the fields as a row.
*
* - $view: The view in use.
* - $fields: an array of $field objects. Each one contains:
* - $field->content: The output of the field.
* - $field->raw: The raw data for the field, if it exists. This is NOT output safe.
* - $field->class: The safe class id to use.
* - $field->handler: The Views field handler object controlling this field. Do not use
* var_export to dump this object, as it can't handle the recursion.
* - $field->inline: Whether or not the field should be inline.
* - $field->inline_html: either div or span based on the above flag.
* - $field->separator: an optional separator that may appear before a field.
* - $row: The raw result object from the query, with all data it fetched.
*
* @ingroup views_templates
*/
?>
<?php foreach ($fields as $id => $field): ?>
<?php $result = db_query('SELECT * FROM {files} WHERE fid = ' . $row->node_data_field_picture_field_picture_fid ); ?>
<?php $data = db_fetch_object( $result ); ?>
<div id="senaste-bilderna-first"><img src="<?= imagecache_create_url('senaste_bilderna_thumbnail', $data->filepath) ?>" alt="" /></div>
<?php /* if (!empty($field->separator)):
<?php print $field->separator;
<?php endif;
<<?php print $field->inline_html; class="views-field-<?php print $field->class; ">
<?php if ($field->label):
<label class="views-label-<?php print $field->class; ">
<?php print $field->label; :
</label>
<?php endif;
<?php
// $field->element_type is either SPAN or DIV depending upon whether or not
// the field is a 'block' element type or 'inline' element type.
<<?php print $field->element_type; class="field-content"><?php print $field->content; </<?php print $field->element_type; >
</<?php print $field->inline_html;>
<?php*/ endforeach; ?>
This is the result
<div class="panel-separator">
</div>
<div class="panel-pane pane-views-panes pane-senaste-bilderna-panel-pane-1" id="pane-senaste-bilderna">
<h2 class="pane-title">Senaste bilderna från galleriet
</h2>
<div class="pane-content">
<div class="view view-senaste-bilderna view-id-senaste_bilderna view-display-id-panel_pane_1 view-dom-id-2">
<div class="view-content">
<div class="views-row views-row-1 views-row-odd views-row-first">
</div>
<div class="views-row views-row-2 views-row-even views-row-last">
</div>
</div>
</div>
</div>
</div>
My Drupal version is 6.16
© Stack Overflow or respective owner