Jump to:
| Project: | Panels |
| Version: | 4.7.x-1.0 |
| Component: | Code |
| Category: | support request |
| Priority: | normal |
| Assigned: | Unassigned |
| Status: | closed (won't fix) |
Issue Summary
Here is what I would like to do: design a page containing content published by several users, with a header title specific to each user.
Here is how I set about it:
1) Design a generic view which uses the argument to pass the uid to the View: the UID is then used as a selection criterion
2) For each user I want to display, user the user signature field to put the title and header
3) In the View, use the argument also in the Page Header to call user_load, then print the signature
It took me quite some time to work out how you pass the argument to the View from Panels - I didn't realise that at first that you have to configure "$arg" on the View URL. But now I have something that works - almost.
The problem I have is, that if I call the View standalone, with the parameter, it works fine. However, if I call the View using Panels, it picks up the argument ok as a selection criterion, but not when it prints the page header.
The only way I have found to get the argument to the View page header is to include the argument in the Panel URL - but this of course defeats the object.
I am using this version of Panels
<?php
// $Id: panels.module,v 1.6 2006/08/27 22:31:08 merlinofchaos Exp $
?>Here is the code for the View:
$view = new stdClass();
$view->name = 'usa_stuff';
$view->description = 'USA stuff published on front page';
$view->access = array (
);
$view->view_args_php = '';
$view->page = TRUE;
$view->page_title = '';
$view->page_header = '<php code begins
print "First argument is " . arg(0) ."<br />";
print "Second argument is " . arg(1) ."<br />";
print "$arg is " . $arg ."<br />";
$publisher = user_load(array(\'uid\' => arg(1)));
print $publisher->signature;
php code ends>';
$view->page_header_format = '2';
$view->page_footer = '';
$view->page_footer_format = '1';
$view->page_empty = '<php code begins
print "Ooops - couldn't find anything!<br />";
print "First argument is " . arg(0) ."<br />";
print "Second argument is " . arg(1) ."<br />";
php code ends>
';
$view->page_empty_format = '2';
$view->page_type = 'list';
$view->url = 'published/$arg';
$view->use_pager = FALSE;
$view->nodes_per_page = '10';
$view->sort = array (
);
$view->argument = array (
array (
'type' => 'uid',
'argdefault' => '1',
'title' => '',
'options' => '',
'wildcard' => '',
'wildcard_substitution' => '',
),
);
$view->field = array (
array (
'tablename' => 'node',
'field' => 'title',
'label' => '',
'handler' => 'views_handler_field_nodelink',
'options' => 'nolink',
),
array (
'tablename' => 'node',
'field' => 'body',
'label' => '',
'handler' => 'views_handler_field_teaser',
),
);
$view->filter = array (
array (
'tablename' => 'node',
'field' => 'promote',
'operator' => '=',
'options' => '',
'value' => '1',
),
array (
'tablename' => 'node',
'field' => 'sticky',
'operator' => '=',
'options' => '',
'value' => '0',
),
);
$view->exposed_filter = array (
);
$view->requires = array(node);
$views[$view->name] = $view;
Comments
#1
fixed in panels 2.