Closed (fixed)
Project:
Views (for Drupal 7)
Version:
5.x-1.6
Component:
Code
Priority:
Normal
Category:
Support request
Assigned:
Unassigned
Reporter:
Created:
30 Oct 2008 at 19:36 UTC
Updated:
14 Jul 2009 at 13:23 UTC
I have links that link to
?sort=desc&order=hits
and
?sort=desc&order=created
and neither of them work.
The default sort is on the votingapi_cache_vote_percent_count field, but this is done in the 'fields' area, not the 'sort' area
Is this something I need to make happen in the views theme function I am calling? It seems like this should happen before it gets there, as the theme function is handed the $nodes, already sorted I presume.
Any ideas/help?
Here's the view exported
$view = new stdClass();
$view->name = 'videos_by_career';
$view->description = '';
$view->access = array (
);
$view->view_args_php = '';
$view->page = TRUE;
$view->page_title = '';
$view->page_header = '';
$view->page_header_format = '1';
$view->page_footer = '';
$view->page_footer_format = '1';
$view->page_empty = 'No Videos for this Career';
$view->page_empty_format = '1';
$view->page_type = 'list';
$view->url = 'videos/by/career';
$view->use_pager = TRUE;
$view->nodes_per_page = '21';
$view->sort = array (
);
$view->argument = array (
array (
'type' => 'content: field_career_ref_reqd',
'argdefault' => '7',
'title' => '',
'options' => '',
'wildcard' => '',
'wildcard_substitution' => '',
),
);
$view->field = array (
array (
'tablename' => 'node_data_field_tileimage',
'field' => 'field_tileimage_fid',
'label' => '',
'handler' => 'content_views_field_handler_group',
'options' => 'imagefield_default',
),
array (
'tablename' => 'node',
'field' => 'title',
'label' => 'title',
'handler' => 'views_handler_field_nodelink',
'options' => 'link',
),
array (
'tablename' => 'node',
'field' => 'created',
'label' => 'created',
'handler' => 'views_handler_field_date_small',
'sortable' => '1',
),
array (
'tablename' => 'node_counter',
'field' => 'totalcount',
'label' => 'hits',
'sortable' => '1',
),
array (
'tablename' => 'votingapi_cache_vote_percent_count',
'field' => 'value',
'label' => 'thumbs',
'handler' => 'votingapi_views_formatter_raw',
'sortable' => '1',
'defaultsort' => 'DESC',
),
);
$view->filter = array (
array (
'tablename' => 'node',
'field' => 'type',
'operator' => 'OR',
'options' => '',
'value' => array (
0 => 'video',
),
),
array (
'tablename' => 'node',
'field' => 'status',
'operator' => '=',
'options' => '',
'value' => '1',
),
);
$view->exposed_filter = array (
);
$view->requires = array(node_data_field_tileimage, node, node_counter, votingapi_cache_vote_percent_count);
$views[$view->name] = $view;
This is the object as a print_r when I'm viewing it with ?sort=desc&order=hits tacked on the url
stdClass Object
(
[vid] => 14
[name] => videos_by_career
[description] =>
[access] => Array
(
)
[page] => 1
[page_title] =>
[page_header] =>
[page_header_format] => 1
[page_empty] => No Videos for this Career
[page_empty_format] => 1
[page_footer] =>
[page_footer_format] => 1
[page_type] => list
[use_pager] => 1
[nodes_per_page] => 21
[url] => videos/by/career
[menu] => 0
[menu_tab] => 0
[menu_tab_weight] => 0
[menu_title] =>
[menu_tab_default] => 0
[menu_tab_default_parent_type] => tab
[menu_parent_title] =>
[menu_parent_tab_weight] => 0
[block] => 0
[block_title] =>
[block_use_page_header] => 0
[block_header] =>
[block_header_format] => 1
[block_use_page_footer] => 0
[block_footer] =>
[block_footer_format] => 1
[block_use_page_empty] => 0
[block_empty] =>
[block_empty_format] => 1
[block_type] => node
[nodes_per_block] => 0
[block_more] => 0
[breadcrumb_no_home] => 0
[changed] => 1225385995
[view_args_php] =>
[is_cacheable] => 0
[sort] => Array
(
)
[argument] => Array
(
[0] => Array
(
[vid] => 14
[type] => content: field_career_ref_reqd
[argdefault] => 7
[title] =>
[options] =>
[position] => 0
[wildcard] =>
[wildcard_substitution] =>
[id] => content: field_career_ref_reqd
)
)
[field] => Array
(
[0] => Array
(
[vid] => 14
[tablename] => node_data_field_tileimage
[field] => field_tileimage_fid
[label] =>
[handler] => content_views_field_handler_group
[sortable] => 0
[defaultsort] =>
[options] => imagefield_default
[position] => 0
[fullname] => node_data_field_tileimage.field_tileimage_fid
[id] => node_data_field_tileimage.field_tileimage_fid
[queryname] => node_data_field_tileimage_field_tileimage_fid
)
[1] => Array
(
[vid] => 14
[tablename] => node
[field] => title
[label] => title
[handler] => views_handler_field_nodelink
[sortable] => 0
[defaultsort] => 0
[options] => link
[position] => 1
[fullname] => node.title
[id] => node.title
[queryname] => node_title
)
[2] => Array
(
[vid] => 14
[tablename] => node
[field] => created
[label] => created
[handler] => views_handler_field_date_small
[sortable] => 1
[defaultsort] => 0
[options] =>
[position] => 2
[fullname] => node.created
[id] => node.created
[queryname] => node_created
)
[3] => Array
(
[vid] => 14
[tablename] => node_counter
[field] => totalcount
[label] => hits
[handler] =>
[sortable] => 1
[defaultsort] => 0
[options] =>
[position] => 3
[fullname] => node_counter.totalcount
[id] => node_counter.totalcount
[queryname] => node_counter_totalcount
)
[4] => Array
(
[vid] => 14
[tablename] => votingapi_cache_vote_percent_count
[field] => value
[label] => thumbs
[handler] => votingapi_views_formatter_raw
[sortable] => 1
[defaultsort] => DESC
[options] =>
[position] => 4
[fullname] => votingapi_cache_vote_percent_count.value
[id] => votingapi_cache_vote_percent_count.value
[queryname] => votingapi_cache_vote_percent_count_value
)
)
[filter] => Array
(
[0] => Array
(
[vid] => 14
[tablename] =>
[field] => node.type
[value] => Array
(
[0] => video
)
[operator] => OR
[options] =>
[position] => 0
[id] => node.type
)
[1] => Array
(
[vid] => 14
[tablename] =>
[field] => node.status
[value] => 1
[operator] => =
[options] =>
[position] => 1
[id] => node.status
)
)
[exposed_filter] => Array
(
)
[build_type] => page
[type] => list
[pager_limit] => 21
[current_page] => 0
[offset] => 0
[used_filters] => Array
(
)
[args] => Array
(
[0] => 10259
)
[total_rows] => 34
[num_rows] => 21
[real_url] => videos/by/career/10259
)
Comments
Comment #1
domesticat commentedClosed while closing all Views support requests with no activity for 6 months. If you still need help, you may re-open this issue at any time.