Views with % placeholders
Johnnyk - March 23, 2009 - 15:29
| Project: | View Alias |
| Version: | 6.x-2.0-beta5 |
| Component: | Code |
| Category: | feature request |
| Priority: | normal |
| Assigned: | emackn |
| Status: | needs review |
Jump to:
Description
I made a replacement Setup with beta5 for d6 and ended up with something like this:
Created Aliases
realm/%/books/Goodkind
realm/%/books/Hennen
realm/%/books/Tolkien
Views2 Path
realm/%/books/2
realm/%/books/3
realm/%/books/1
Instead of replacing the % letters the arguments were appended
My Views Url is: realm/%/books
Thank you for your wonderful work with this module!

#1
heh, I knew there was a use case out there that gave way to supporting tokens.
Now just have to figure out how. Might be pretty easy. I think pathauto probably covers this somewhere, so I can probably just use something from their API.
I'm changing this to a feature request instead of a bug, since I never thought to cover taxonomy replacement, just appending.
I do have one question about your URL, realm/%/books. Does 'books' have any meaning? Is it needed by the view as an argument?
It would also help if you could export your view and attach it so I can see how you are setting it up. It will give me a good test case.
#2
added with beta6
#3
How to make the same effect in drupal5 version ?? i
#4
Hi Emackn
I'm currently in Singapore. And it seems, that Singapore for me is a bit further away from the internet :)
realm/%/books links to a views page. books itself is not an argument, it just there to have realm/%/xyz free for other listings, eg. characters, movies etc.
Here is my View:
$view = new view;$view->name = 'books';
$view->description = 'List all Books';
$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', 'Defaults', 'default');
$handler->override_option('fields', array(
'teaser' => array(
'label' => '',
'alter' => array(
'alter_text' => 0,
'text' => '',
'make_link' => 0,
'path' => '',
'alt' => '',
'prefix' => '',
'suffix' => '',
'help' => '',
'trim' => 0,
'max_length' => '',
'word_boundary' => 1,
'ellipsis' => 1,
'html' => 0,
),
'exclude' => 0,
'id' => 'teaser',
'table' => 'node_revisions',
'field' => 'teaser',
'override' => array(
'button' => 'Override',
),
'relationship' => 'none',
),
));
$handler->override_option('arguments', array(
'tid' => array(
'default_action' => 'empty',
'style_plugin' => 'default_summary',
'style_options' => array(),
'wildcard' => 'all',
'wildcard_substitution' => 'All',
'title' => '',
'default_argument_type' => 'fixed',
'default_argument' => '',
'validate_type' => 'taxonomy_term',
'validate_fail' => 'not found',
'break_phrase' => 0,
'add_table' => 0,
'require_value' => 0,
'reduce_duplicates' => 0,
'set_breadcrumb' => 0,
'id' => 'tid',
'table' => 'term_node',
'field' => 'tid',
'relationship' => 'none',
'default_options_div_prefix' => '',
'default_argument_user' => 0,
'default_argument_fixed' => '',
'default_argument_php' => '',
'validate_argument_node_type' => array(
'family_individual' => 0,
'family_group' => 0,
'family_location' => 0,
'books' => 0,
'characters' => 0,
'charbookdesc' => 0,
'page' => 0,
'story' => 0,
),
'validate_argument_node_access' => 0,
'validate_argument_nid_type' => 'nid',
'validate_argument_vocabulary' => array(
'1' => 1,
'2' => 0,
),
'validate_argument_type' => 'tid',
'user_argument_type' => 'uid',
'restrict_user_roles' => 0,
'user_roles' => array(),
'validate_argument_node_flag_name' => '*relationship*',
'validate_argument_node_flag_test' => 'flaggable',
'validate_argument_node_flag_id_type' => 'id',
'validate_argument_user_flag_name' => '*relationship*',
'validate_argument_user_flag_test' => 'flaggable',
'validate_argument_user_flag_id_type' => 'id',
'validate_argument_php' => '',
),
));
$handler->override_option('access', array(
'type' => 'none',
));
$handler = $view->new_display('page', 'Page', 'page_1');
$handler->override_option('path', 'realm/%/books');
$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,
));