Closed (works as designed)
Project:
Views (for Drupal 7)
Version:
4.7.x-1.x-dev
Component:
Code
Priority:
Critical
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
3 Jul 2006 at 15:44 UTC
Updated:
3 Jul 2006 at 18:45 UTC
NOTE: this is a split post from http://drupal.org/node/55448
I will post the issue in detail in a second post below.
Comments
Comment #1
asparagus commentedIt seems that a combination of url_aliases and multiple filters on taxonomies provides for some very unexpected results. As i'm a little stumped about the cause, i'll simply describe the situation in detail.
I have a site with four views. Of these four views, 2 are page views. These page views are accessed using 'url aliases' provided by the 'path' module. I'm using aliases to access these page views as i have navigation that is created and will not render the menu if the node aliased to this page is not published. If i do not use 'url aliases' and use the url field in the view, things work fine but i have no way to determine if the page is a view as i cannot obtain a
views/vidtype url fromdrupal_get_normal_pathfunction. It would seem that setting up a url_alias should be no problem. It causes some very odd issues though. What seems to happen is that both of the url's provide only the last view created.I've encluded a section of the menu code as well as the export of the two views.
Please let me know if further detail is required.
Thank you in advance.
here is a excerpt from the menu code for reference
view one - works if view two doesn't exist
view two - takes everything over
Comment #2
merlinofchaos commentedNeither of the exported views have URLs at all. Please explain to me how you're accessing these views. I feel like there's something absolutely key that you're not explaining, and it's this something that's causing your basic problem.
At this point I'm feeling more and more like it's not actually a problem with Views, but that you're doing something you think should work and does not; but that's just a feeling based upon not having enough information about what you're actually doing.
Comment #3
merlinofchaos commentedAlso, where is this menu code you're showing? You're using code that pulls from info deep in the menu system, but it's not clear to me where this code is actually located, or what it's actually attempting to do.
Comment #4
merlinofchaos commentedOk, I think I've figured out that your menu code is probably in menu.inc and you've actually hacked your Drupal install a bit. [IMO not the right way to accomplish this but that's another issue entirely].
You've got url aliases, but the views you've exported don't have URLs. This is part that is the most confusing to me right now. (Note the $view->url = '' in both views).
From the look of the code, it appears that your URLs should be more along the lines of 'view/foo' or 'view/bar' where you're using the first part of the URL to identify it as a view; if that were the case, that would make a little more sense to me.
Comment #5
asparagus commentedhello.
let me try to answer your two questions.
url's
neither view provides a url, that is correct. however, path aliases have been created for both views using the core 'path' module. the two aliases are as follows "pathPart/pageName" is the alias and "views/vid" is the system path. i'm using these as i need to know whether the menu item being referenced is for a "view" or for a "node".
I am using these settings as otherwise if i specify a url in the view itself, the call to
drupal_get_normal_pathdoes not return the "views/vid" system structure.menu function
the menu code has nothing to do with this problem and was shown only for reference. i know that this is the case as also using the standard pushbutton theme will produce the same results with "out of the box" menu code. however, the code lives in my theme's php_template file.
views seems to treat the core path alias module differently than any of the other sections. ie "node, user, image, taxonomy" and this seems to be an issue.
please let me know if you need any further information.
thank you.
Comment #6
asparagus commentedjust got your post and perhaps i'm seeing the issue as well but let me verify something.
if i specify a url in the 'url' field for a view, how do i then access that view url?
is it?
A - www.mysite.com/views/view_url
or
B - www.mysite.com/view_url
i was using the view id to access the views, so did not think a url was required as it is an optional field.
concerning the menu, however, i am not hacking the core at all, as i quite agree that that is the wrong approach. i am however, customizing a theme to generate a theme specific menu functionality.
thx.
Comment #7
merlinofchaos commentedThe views URL is specified exactly the same way that your path aliases are specified.
Views does not automatically provide a URL such as 'view/vid' in the same way that there is a node/nid or a taxonomy/tid, you are correct. This is because not all views are URL viewable, so a global 'view/vid' is not appropriate. Originally, views DID work somewhat like this, but the vast majority of the time, 'view/vid' is not an appropriate URL, and an alias is required. Aliases have certain weaknesses (as you can must know since your code is basically trying to account for those very weaknesses). If you want that a view/vid, you'll have to enter that as the URL.
Here is a question for you: If your code sees a menu item, and determines that it is not a node at all, shouldn't it just assume the menu item is ok and print it? You don't actually do anything with the information that it's a view except set $isActive, which I assume prints the menu item. Shouldn't you simply have:
Using that, you wouldn't need to alias the view at all, and the code needn't care that it's a view.
Comment #8
asparagus commentedagain, thanks for the response.
indeed i could simply use default on the switch, but don't want things to show up for "user, admin, etc", so i thought specifically switching on "views" was the more efficient option.
there is also one last catch where this alias is also important, which is within the page.tpl.php file for the theme. the menu structure for the entire set is built out with aliases using a combination of manual 'views' aliases [ ie our issue ] and aliases generated with path_auto. when a page is called up, i check to see if there is a system entry for this alias and if not, i generate a custom 404 with an email link indicating the offending page call.
it was then my assumption that views lack of similarity with other similar drupal elements [ ie the "views/vid" issue ] was a bug.
perhaps a workaround would be to create a url for each view such as "views/my_view_url" and then create an alias from "pathPart/pageName" to "views/my_view_url". seems a bit much to get 'views' to function more closely to what seems to me to be standard practice with id's etc. however, i'm don't have a long history with drupal and i understand that sometimes legacy code/structure can play a large part in things.
your opinion would be much appreciated.
thank you.
Comment #9
merlinofchaos commentedThis doesn't really have anything to do with legacy code; it really is that not every view has a URL (views that provide only blocks, or views that exist just for customization) at all, and it seemed more efficient and more user friendly to let the user select the URL. In the future, Drupal is likely to make it easier to make generalized URLs, rather than the system/ID format that we see a lot of, whose URLs are so very often overridden anyway.
That said, I think you can accomplish what you seek simply by entering view/name in the URL field of the view, and then setting your alias up to point to that view.
For those other items (User, admin, etc) can't you just disable them using the normal drupal menu system? It seems like your check for unpublished nodes should be more of a special case, rather than the norm.
Comment #10
asparagus commentedthat solution seems to be the one i'll go with.
sorry that i thought it was a bug, but given the variations in working methods kind of threw me.
thanks for the responses.