Closed (fixed)
Project:
Views (for Drupal 7)
Version:
6.x-2.0-rc1
Component:
page displays
Priority:
Normal
Category:
Support request
Assigned:
Unassigned
Reporter:
Created:
26 Aug 2008 at 17:43 UTC
Updated:
11 Sep 2008 at 05:33 UTC
I've set up a view, as per below, which should work with "%/%/%" (year/month/day). However, going to e.g. "2008/08/18" gives me a "page not found". Any hints as to what I could look at would be appreciated, as I'd really like to make my URLs "hackable". :) (It should probably be noted that "Live preview" works exactly as I want it. It's only when I actually try to access the view it messes up.)
$view = new view;
$view->name = 'story_archive';
$view->description = '';
$view->tag = 'archive';
$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', 'Standard', 'default');
$handler->override_option('fields', array(
'title' => array(
'id' => 'title',
'table' => 'node',
'field' => 'title',
),
'created' => array(
'id' => 'created',
'table' => 'node',
'field' => 'created',
),
'view_node' => array(
'id' => 'view_node',
'table' => 'node',
'field' => 'view_node',
),
'teaser' => array(
'id' => 'teaser',
'table' => 'node_revisions',
'field' => 'teaser',
),
'comment_count' => array(
'id' => 'comment_count',
'table' => 'node_comment_statistics',
'field' => 'comment_count',
),
));
$handler->override_option('sorts', array(
'created' => array(
'order' => 'DESC',
'granularity' => 'second',
'id' => 'created',
'table' => 'node',
'field' => 'created',
'relationship' => 'none',
),
));
$handler->override_option('arguments', array(
'created_year' => array(
'id' => 'created_year',
'table' => 'node',
'field' => 'created_year',
'validate_type' => 'none',
'validate_fail' => 'not found',
'default_argument_type' => 'node',
'relationship' => 'none',
'title' => 'Archive » %1',
'default_action' => 'not found',
'wildcard' => '',
'wildcard_substitution' => '',
'default_options_div_prefix' => '',
'default_argument_user' => 0,
'default_argument_fixed' => '',
'default_argument_php' => '',
'validate_argument_node_type' => array(
'page' => 0,
'story' => 0,
),
'validate_argument_node_access' => 0,
'validate_argument_nid_type' => 'nid',
'validate_argument_vocabulary' => array(
'1' => 0,
'2' => 0,
),
'validate_argument_type' => 'tid',
'validate_argument_php' => '',
),
'created_month' => array(
'id' => 'created_month',
'table' => 'node',
'field' => 'created_month',
'validate_type' => 'none',
'validate_fail' => 'not found',
'default_argument_type' => 'fixed',
'relationship' => 'none',
'title' => 'Archive » %1 » %2',
'default_action' => 'not found',
'wildcard' => '',
'wildcard_substitution' => '',
'default_options_div_prefix' => '',
'default_argument_user' => 0,
'default_argument_fixed' => '',
'default_argument_php' => '',
'validate_argument_node_type' => array(
'page' => 0,
'story' => 0,
),
'validate_argument_node_access' => 0,
'validate_argument_nid_type' => 'nid',
'validate_argument_vocabulary' => array(
'1' => 0,
'2' => 0,
),
'validate_argument_type' => 'tid',
'validate_argument_php' => '',
),
'created_day' => array(
'id' => 'created_day',
'table' => 'node',
'field' => 'created_day',
'validate_type' => 'none',
'validate_fail' => 'not found',
'default_argument_type' => 'fixed',
'relationship' => 'none',
'title' => 'Archive » %1 » %2 » %3',
'default_action' => 'not found',
'wildcard' => '',
'wildcard_substitution' => '',
'default_options_div_prefix' => '',
'default_argument_user' => 0,
'default_argument_fixed' => '',
'default_argument_php' => '',
'validate_argument_node_type' => array(
'page' => 0,
'story' => 0,
),
'validate_argument_node_access' => 0,
'validate_argument_nid_type' => 'nid',
'validate_argument_vocabulary' => array(
'1' => 0,
'2' => 0,
),
'validate_argument_type' => 'tid',
'validate_argument_php' => '',
),
));
$handler->override_option('filters', array(
'promote' => array(
'operator' => '=',
'value' => 1,
'group' => '0',
'exposed' => FALSE,
'expose' => array(
'operator' => FALSE,
'label' => '',
),
'id' => 'promote',
'table' => 'node',
'field' => 'promote',
'relationship' => 'none',
),
'status_extra' => array(
'id' => 'status_extra',
'table' => 'node',
'field' => 'status_extra',
),
'type' => array(
'operator' => 'in',
'value' => array(
'story' => 'story',
),
'group' => '0',
'exposed' => FALSE,
'expose' => array(
'operator' => 'type_op',
'label' => 'Indhold: Type',
'use_operator' => FALSE,
'identifier' => 'type',
'remember' => FALSE,
'single' => TRUE,
'optional' => TRUE,
'reduce' => FALSE,
),
'id' => 'type',
'table' => 'node',
'field' => 'type',
'relationship' => 'none',
),
));
$handler->override_option('access', array(
'type' => 'none',
'role' => array(),
'perm' => '',
));
$handler->override_option('empty', 'No entries posted during this unit of time.');
$handler->override_option('empty_format', '1');
$handler->override_option('link_display', 'page_2');
$handler->override_option('row_plugin', 'node');
$handler->override_option('row_options', array(
'teaser' => 1,
'links' => 1,
));
$handler = $view->new_display('page', 'Månedsvisning', 'page_1');
$handler->override_option('arguments', array(
'created_year' => array(
'id' => 'created_year',
'table' => 'node',
'field' => 'created_year',
'validate_type' => 'none',
'validate_fail' => 'not found',
'default_argument_type' => 'node',
'relationship' => 'none',
'title' => 'Archive » %1',
'default_action' => 'not found',
'wildcard' => '',
'wildcard_substitution' => '',
'default_options_div_prefix' => '',
'default_argument_user' => 0,
'default_argument_fixed' => '',
'default_argument_php' => '',
'validate_argument_node_type' => array(
'page' => 0,
'story' => 0,
),
'validate_argument_node_access' => 0,
'validate_argument_nid_type' => 'nid',
'validate_argument_vocabulary' => array(
'1' => 0,
'2' => 0,
),
'validate_argument_type' => 'tid',
'validate_argument_php' => '',
),
'created_month' => array(
'id' => 'created_month',
'table' => 'node',
'field' => 'created_month',
'validate_type' => 'none',
'validate_fail' => 'not found',
'default_argument_type' => 'fixed',
'relationship' => 'none',
'title' => 'Archive » %1 » %2',
'default_action' => 'not found',
'wildcard' => '',
'wildcard_substitution' => '',
'default_options_div_prefix' => '',
'default_argument_user' => 0,
'default_argument_fixed' => '',
'default_argument_php' => '',
'validate_argument_node_type' => array(
'page' => 0,
'story' => 0,
),
'validate_argument_node_access' => 0,
'validate_argument_nid_type' => 'nid',
'validate_argument_vocabulary' => array(
'1' => 0,
'2' => 0,
),
'validate_argument_type' => 'tid',
'validate_argument_php' => '',
),
));
$handler->override_option('empty', 'No entries posted this month.');
$handler->override_option('empty_format', '1');
$handler->override_option('path', '%/%');
$handler->override_option('menu', array(
'type' => 'none',
'title' => '',
'weight' => 0,
));
$handler->override_option('tab_options', array(
'type' => 'none',
'title' => '',
'weight' => 0,
));
$handler = $view->new_display('page', 'Årsvisning', 'page_2');
$handler->override_option('arguments', array(
'created_year' => array(
'id' => 'created_year',
'table' => 'node',
'field' => 'created_year',
'validate_type' => 'none',
'validate_fail' => 'not found',
'default_argument_type' => 'node',
'relationship' => 'none',
'title' => 'Archive » %1',
'default_action' => 'not found',
'wildcard' => '*',
'wildcard_substitution' => 'All years',
'default_options_div_prefix' => '',
'default_argument_user' => 0,
'default_argument_fixed' => '',
'default_argument_php' => '',
'validate_argument_node_type' => array(
'page' => 0,
'story' => 0,
),
'validate_argument_node_access' => 0,
'validate_argument_nid_type' => 'nid',
'validate_argument_vocabulary' => array(
'1' => 0,
'2' => 0,
),
'validate_argument_type' => 'tid',
'validate_argument_php' => '',
),
));
$handler->override_option('empty', 'No entries posted this year.');
$handler->override_option('empty_format', '1');
$handler->override_option('path', '%');
$handler->override_option('menu', array(
'type' => 'none',
'title' => '',
'weight' => 0,
));
$handler->override_option('tab_options', array(
'type' => 'none',
'title' => '',
'weight' => 0,
));
$handler = $view->new_display('page', 'Dagsvisning', 'page_3');
$handler->override_option('empty', 'No entries posted this day.');
$handler->override_option('empty_format', '1');
$handler->override_option('path', '%/%/%');
$handler->override_option('menu', array(
'type' => 'none',
'title' => '',
'weight' => 0,
));
$handler->override_option('tab_options', array(
'type' => 'none',
'title' => '',
'weight' => 0,
));
Comments
Comment #1
merlinofchaos commentedThe Drupal menu system doesn't support having a % in the first place of the menu item.
Comment #2
merlinofchaos commentedI added validation to prevent this in the future.
Comment #3
Anonymous (not verified) commentedAutomatically closed -- issue fixed for two weeks with no activity.