Hi, I'm trying to display a list of nodes with a particular taxonomy term using inline url arguments. From what I gather in the provided documentation if I want to have the argument to be in the middle of the url I would need to fudge the url to something like "taxonomy/$arg/display" where $arg is the taxonomy term id.
Using Drupal 5.0 rc1 & Views 5.x-1.4-2rc1, I don't seem to be able to get this to work. It returns with a 404 page not found error. Removing the $arg in the url (i.e. "taxonomy/display") and just appending the term at the end of it gives a usable output so I know that the views page I have set up is workable.
I don't know how to get debug output for you but attached are two gif files containing the output from my devel.module queries which might help you. Looks like the url is not recognised as a views page. Am I doing something wrong here or is it a bug? This issue might be related to this other one. http://drupal.org/node/104854
Path module is disabled
Cache is on. Not aggressive caching.
Cache has been flushed.
Thanks.
$view = new stdClass();
$view->name = 'nav_test';
$view->description = 'Navigation for website';
$view->access = array (
0 => '1',
1 => '2',
2 => '3',
3 => '4',
);
$view->view_args_php = '';
$view->page = TRUE;
$view->page_title = '';
$view->page_header = '';
$view->page_header_format = '3';
$view->page_footer = '';
$view->page_footer_format = '3';
$view->page_empty = '';
$view->page_empty_format = '3';
$view->page_type = 'table';
$view->url = 'taxonomy/$arg/display';
$view->use_pager = TRUE;
$view->nodes_per_page = '10';
$view->sort = array (
);
$view->argument = array (
array (
'type' => 'taxid',
'argdefault' => '2',
'title' => '%1',
'options' => '0',
'wildcard' => '',
'wildcard_substitution' => '',
),
);
$view->field = array (
array (
'tablename' => 'node',
'field' => 'title',
'label' => 'Title',
'handler' => 'views_handler_field_nodelink_with_mark',
'sortable' => '1',
'options' => 'link',
),
array (
'tablename' => 'node_data_field_introduction',
'field' => 'field_introduction_value',
'label' => 'Description',
'options' => 'trimmed',
),
array (
'tablename' => 'term_node_2',
'field' => 'name',
'label' => 'System',
'options' => 'nolink',
),
array (
'tablename' => 'term_node_3',
'field' => 'name',
'label' => 'Level of difficulty',
'options' => 'nolink',
),
);
$view->filter = array (
array (
'tablename' => 'node',
'field' => 'type',
'operator' => 'OR',
'options' => '',
'value' => array (
0 => 'problem_based_tutorial',
),
),
array (
'tablename' => 'node',
'field' => 'distinct',
'operator' => '=',
'options' => '',
'value' => array (
),
),
array (
'tablename' => 'node',
'field' => 'status',
'operator' => '=',
'options' => '',
'value' => '1',
),
array (
'tablename' => 'term_node_3',
'field' => 'tid',
'operator' => 'OR',
'options' => '',
'value' => array (
0 => '13',
1 => '14',
2 => '15',
),
),
);
$view->exposed_filter = array (
);
$view->requires = array(node, node_data_field_introduction, term_node_2, term_node_3);
$views[$view->name] = $view;
| Comment | File | Size | Author |
|---|---|---|---|
| #1 | with-args-appended-to-end-of-url.gif | 37.92 KB | Fajan |
| with-args-in-middle-of-url.gif | 18.23 KB | Fajan |
Comments
Comment #1
Fajan commentedNext image
Comment #2
merlinofchaos commentedIt appears that you have the default for your argument set to Page Not Found. So my first question is: What is the actual URL you are going to? If it thinks there is not an argument it will return a page not found.
Try setting the default to something like 'summary' instead and see if that changes anything?
Comment #3
mattmackenzie commentedI have the same problem, regardless of the default I set. This is kind of a downer :(
Comment #4
merlinofchaos commentedComment #5
sign commentednot working for me too,
I just tried to create simple view with url user/$arg/track
argument was user uid is author, etc...
this doesn't work in 5.x
and also I tried to create totally same view in 4.7 and it works
Comment #6
merlinofchaos commentedAhh, the method of caching menu entries for inline arguments changed, but when the view is saved from the UI, the cache isn't invalidated. As a workaround, you may clear the cache (submit from the modules page).
Also, -1 points to everyone who posted in this issue without following the advice:
Before submitting your bug report, try clearing your cache (DELETE FROM cache; OR submitting your modules page) as Views caches data provided by modules.
Comment #7
merlinofchaos commentedComment #8
sign commentedI even didnt notice that message. ;) sorry for that, I fixed that before by deleting the cache. Will read messages from now for posting bugs :)
Comment #9
marcor commentedIMHO this should become a bug. It should be possible to create a view with inline args without running the module update script.
In case that this is no bug, but feature (harhar), then the documentation should be updated. ;)
Until then I'll leave a note in the tutorial that explains the creation of views with $args and tabs here.
Comment #10
rdollete commentedI'm still getting the "Page not found" error no matter what my default is, and even after clearing the cache.
Comment #11
rdollete commentedOkay, I got it working, but only after using the Devel module to empty the cache.
Comment #12
djorn commentedDELETE FROM cache works
+1 on the bug report
Comment #13
merlinofchaos commentedThis will be fixed in 1.6
Comment #14
(not verified) commentedComment #15
rapidsynergy commentedHi everybody- I've tried all the suggestions mentioned here but am still not able to get my views to work with arguments- even using the default taxonomy_term view does not work! I have no problems using this functionality in 4.7. I've tried clearing the cache, running the update script etc. but no go. Am I missing something here? Thanks for your help.
Comment #16
rapidsynergy commentedOk after working on this for 2 days - I tried a third install of Drupal 5.1 and finally got the view arguments working. Exporting my views and importing them into them into my original install got the ball rolling. Now they work again! I'm thoroughly perplexed. The first 2 installs had the contributed category module installed. I had been experimenting with the category views module with no success. Could that be a factor somehow? Anyhow, I'm sticking with core taxonomy for now until I have a better understanding of how the category module and the views module interplay.
BTW, props to the Views module dev guys. Very impressive!
Comment #17
rimma commentedHi,
the document only talks about how to make tab for newest and Alpha.
They are special situations.
If you want to establish tabs, for example, article-eduction;article -business;article-literature...
I am not sure if this way works.
I try to do it using the way mentioned in the article, but I found the path become a little bit weired.
like this /article/%24arg/eduction
so I delete $arg, work fine. but the tab path has a little problem. all tab paths point to /article.
I do not know why.
I have updated.