I am trying to create views with one of the arguments, which shows titles of found nodes.
Term ID argument from taxonomy vocabulary.

Has defined one argument
Taxonomy: Term ID
Action to take if argument is not present: Display all values
Wildcard: all
Wildcard title: All
Validator: Basic validation

Page settings
Path: zzz/%

Results:
Preview
works both: with attibutes and without attibutes

URL: zzz/4
works, I am receiving the list of node titles which has the correspondent term

URL: zzz/all
is working, receiving the list of nodes

URL: zzz
Does not work, instead of the list of all nodes I am receiving the error "404 - not found"

Where is the bag? The Views definitions are :

$view = new view;
$view->name = 'zzz';
$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', 'Defaults', 'default');
$handler->override_option('fields', array(
  'title' => array(
    'label' => '',
    'alter' => array(
      'alter_text' => 0,
      'text' => '',
      'make_link' => 1,
      'path' => 'alx/[type_machine]',
      'link_class' => '',
      'alt' => '',
      'prefix' => '',
      'suffix' => '',
      'help' => '',
      'trim' => 0,
      'max_length' => '',
      'word_boundary' => 1,
      'ellipsis' => 1,
      'strip_tags' => 0,
      'html' => 0,
    ),
    'link_to_node' => 0,
    'exclude' => 0,
    'id' => 'title',
    'table' => 'node',
    'field' => 'title',
    'relationship' => 'none',
  ),
));
$handler->override_option('arguments', array(
  'tid' => array(
    'default_action' => 'ignore',
    'style_plugin' => 'default_summary',
    'style_options' => array(),
    'wildcard' => 'all',
    'wildcard_substitution' => 'Все',
    'title' => 'ZZZ %1',
    'breadcrumb' => '',
    'default_argument_type' => 'fixed',
    'default_argument' => '',
    'validate_type' => 'none',
    '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',
    'validate_user_argument_type' => 'uid',
    'validate_user_roles' => array(
      '2' => 0,
      '4' => 0,
      '3' => 0,
    ),
    'override' => array(
      'button' => 'Override',
    ),
    'relationship' => 'none',
    'default_options_div_prefix' => '',
    'default_argument_user' => 0,
    'default_argument_fixed' => '',
    'default_argument_php' => '',
    'validate_argument_node_type' => array(
      'product' => 0,
      'site' => 0,
      'page' => 0,
      'service' => 0,
      'story' => 0,
    ),
    'validate_argument_node_access' => 0,
    'validate_argument_nid_type' => 'nid',
    'validate_argument_vocabulary' => array(
      '2' => 0,
    ),
    'validate_argument_type' => 'tid',
    'validate_argument_transform' => 0,
    'validate_user_restrict_roles' => 0,
    'validate_argument_php' => '',
  ),
));
$handler->override_option('filters', array(
  'status_extra' => array(
    'operator' => '=',
    'value' => '',
    'group' => '0',
    'exposed' => FALSE,
    'expose' => array(
      'operator' => FALSE,
      'label' => '',
    ),
    'id' => 'status_extra',
    'table' => 'node',
    'field' => 'status_extra',
    'relationship' => 'none',
  ),
));
$handler->override_option('access', array(
  'type' => 'none',
));
$handler->override_option('cache', array(
  'type' => 'none',
));
$handler->override_option('title', 'ZZZ');
$handler->override_option('style_plugin', 'grid');
$handler->override_option('style_options', array(
  'grouping' => '',
  'columns' => '3',
  'alignment' => 'horizontal',
));
$handler = $view->new_display('page', 'Страница', 'page_1');
$handler->override_option('path', 'zzz/%');
$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,
));

Comments

superbaloo’s picture

In the argument configuration check two things :

Action to take if argument is not present:
Display all values

and

Action to take if argument does not validate:
Display all values

superbaloo’s picture

Status:Active» Fixed

Closing it

kalx’s picture

Status:Fixed» Active

In the argument configuration check two things :

Action to take if argument is not present:
Display all values

and

Action to take if argument does not validate:
Display all values

Not working.
If you have an example of functioning views, please, paste it into your reply.

kalx’s picture

I have researched the source Drupal code, file includes/menu.inc

function menu_get_item($path = NULL, $router_item = NULL) {
...
if ($router_item = db_fetch_array(db_query_range('SELECT * FROM {menu_router} WHERE path IN (...

The function process the query of the following type
SELECT * FROM menu_router WHERE path IN ('zzz') ORDER BY fit DESC

In DB in the table 'menu_router' there is only one suitable record of the field 'path' = 'zzz/%'
but, such a SQL query NEVER will be able to find this record!!!

superbaloo’s picture

Try with zzz as path of the views ?

kalx’s picture

Status:Active» Fixed

Thanks! Now all right.

Status:Fixed» Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

trofimchouk’s picture

Status:Closed (fixed)» Active

> Try with zzz as path of the views ?

I think this notice should be added to View -> Page settings -> Path. Yesterday I've faced this issue, and the answer not to use '%' wasn't so obvious. Furthermore I've found a lot of similar question in local drupal community and no answers were given. So I'm sure this addition will be useful.

Now it's: "This view will be displayed by visiting this path on your site. You may use "%" in your URL to represent values that will be used for arguments: For example, "node/%/feed".

Should be smth like: "This view will be displayed by visiting this path on your site. You may use "%" in your URL to represent values that will be used for arguments: For example, "node/%/feed. To use argument only in the end of the path just enter 'path/to/your/view' instead of 'path/to/your/view/%'".

dawehner’s picture

Component:Views Data» Documentation
Issue tags:+documentation

Update stuff

merlinofchaos’s picture

Status:Active» Closed (fixed)

I'm sorry, but I have trouble understanding why people expect that '/foo/bar' matches '/foo/bar/%'.

Even if you get rid of the placeholder, there's an extra slash there. It's a completely different part of the URL.

In addition to this, the advanced help for that form contains a more thorough explanation (click the question mark above the path setting in the form) of how paths work. And while it doesn't call out that the /% shouldn't be used in the situation you're discussing, it does talk about how arguments are passed at the end of the URL automatically.

dazweeja’s picture

Just ran into this problem today. I think the documentation suggestion in #8 would have saved me a bit of time.

As for, "I'm sorry, but I have trouble understanding why people expect that '/foo/bar' matches '/foo/bar/%".

I don't think people expect this at all. I think people expect that if they use '/foo/bar/%' as the path in Views in combination with 'Display all values' for 'Action to take if argument is not present:', then all values will be displayed when the argument is not present, ie. when the path is '/foo/bar/'. They're not. They get a 404.

As far as I can tell, you *must* use '/foo/bar' as the path in Views to get the desired behaviour in this case (or more intuitively '/foo/bar/' but Views will strip out the trailing slash anyway). It's unexpected (to me at least). Which is why #8 is required.

k3vin’s picture

I remembered in one of an older Views version the option "Action to take if argument is not present: Display all values" worked. So i am very wondered why this option does not work anymore. This option make sense in combination with the "Wildcard" option (and other cases). So it would be useful if the wildcard field is blank then "Display all values."

The only solution actually is to create an own view for the parent path to show all values or something else.

dazweeja’s picture

@k3vin, it does work.

Just use '/foo/bar' as the path in Views instead of '/foo/bar/%' when the wildcard is at the end of the path. Everything works as expected, including wildcard substitutions. Some of us were just asking for a small change to the description on the Views edit page to make this clearer.

Vacilando’s picture

Version:6.x-2.6» 6.x-2.11

Ran into this problem today. Absolutely counter-intuitive. The change at #8 would help a lot!

aricw’s picture

I absolutely agree with #8, I ran into this problem today as well.