I use Views for just about everything on my page, and it works great. It has but one problem:
Because I use Views a lot, many nodes on my page are accessible through Views only. I may be using it the wrong way, i.e. not as an additional listing of forum topics, blog entries, et cetera, but as main and only listing of articles, protocols, letters et cetera. However, the nodes linked to by Views do not know about Views; this is mostly apparent in the Breadcrumbs of those nodes, they all just point to 'Home', instead of 'Home » Corresponding View'.
I know that the breadcrumbs can be extended for example by taxonomy module; but then the breadcrumbs link to the taxonomy page, not my custom themed Views. There are also other things that can't be done, for example a back/next link that selects the next item of the same View. (I know there's a snippet for that in the handbook here, but this shows the nodes only, not an overview of them).
I've thought of two ways to make Views more powerful:
- reverse lookups could allow a query to the Views module that tells us wether or not the current node is included in any of the views. It would have to provide information about the name and url of the view, as well as the position of the current node in the view. With this information breadcrumbs etc. could be generated by overriding PHPTemplate breadcrumb function.
- embedding nodes would be a different approach; instead of having a View link to the original nodes, it would refer to a dynamically generated Views-node that simply embeds the original node. With this it would automatically be clear which View this node belongs to, and Views itself could take care of breadcrumbs, next/previous/parent links, etc. This would also solve the problem that one and the same node could be linked by several Views.
I'm not actually a Drupal developer, so these are just random thoughts. I have no idea wether a reverse lookup can be implemented efficiently (I imagine that instead of applying filters to all nodes for one view, you'd have to apply all filters of every view for one node), and I don't know wether nodes can be embedded without hurting custom layout / theming of those nodes.
I'd just like to have a Home » 'Name of View' » Node breadcrumb really. :-)
Comments
Comment #1
merlinofchaos commentedThese two things that you ask for are kind of a holy grail.
Unfortunately, it's not feasible with Drupal's current design. Without any information passed to the node about where you came from, it's *really* difficult to put together a proper breadcrumb trail, and at the moment it's moderately difficult to do that.
If you want to play around with it, though, I can perhaps suggest toying with theming the fields and perhaps modifying the links that Views creates to your node to pass along a little more info, or go to a custom page instead of the node itself. There's some real possibility, there.
Comment #2
moshe weitzman commentedright. earl is basically suggesting that you pursue 'embedding' solution using views themeing of links and some custom code that does node_view() and drupal_set_breadcrumb().
an alternate approach is to think of breadcrumb as a list of recently viewed pages. so you could just store the drupal path, $_GET['q'], of each of the past 4 page views in the $_SESSION object and use those to construct a breadcrumb in hook_nodeapi('view'). The breadcrumb could be a stright list of those paths or more complicated (i.e. look most recent views url and just use that).
in any case, i don't think views is going to help you here. marking as 'by design'
Comment #3
zach harkey commentedThis sounds like what I may want to do, but I'm having a hard time wrapping my head around it. Would you mind elaborating enough to get me off in the right direction?