I would like to effectively replace the nodes with views that would show the "full content" of a node with items to display set to 1. (Each paged page of the view would thus include only one node and the pager - effectivly i'm trying to use views' pager for nodes).
Now, what I am missing is the possibility of having aliases of the paths that include given nodes. I would like the pages to have paths like site.com/myview/nodetitle, not site.com/myview/1.
The aim is to replace the links to nodes in a context of a given view by links to single - node views, thus obtaining views pagination on node-alike. So the "title" field would be linked to, say, site.com/myview/nodetitle, wichh would be the single - node - position in a that has the same cireteria etc as the one I am coming from, but with full node view and a views pager. I am trying to replicte the features from views-navigation.
Is there any way to achieve that?
EDIT: i do not want to use contextual filters, as I do want the view to include many nodes, with 1 node showing per page
1 Answer
I would not use views at all. Pathauto will help you with the aliasing. So, on hook_init you can set the pathauto pattern for that node type to be 'myview/[node:title]'. Such as this:
function myMod_init() {
variable_set('pathauto_node_yournode_pattern', 'myview/[node:title]');
}
For the pagination, I'm not sure what your use case is like. If you could have the nids gathered via a db_query and passed to your 'page callback' function, you could construct your own "next" and "previous" buttons containing the correct href. You will find function such as drupal_get_path_alias() or url() to be very useful here.
If you wanted a pagination with proper numbering, you can look into EFQ. It has pager as a public method. Although, that will probably give you query like url such as ?page=1, etc. and not the nice alias pathauto had created for you.
All in all, more information about your usecase will be useful. But this method will give you a lot more flexibilities than using views IMO.
-
I explained myself more by editing the main post. Paging is what I am after– DalmazCommented Jul 23, 2014 at 17:39
-
1@Dalmaz EFQ, db_select or db_query will still be a good and flexible solution. EFQ is a class with pager as a public method you can use. You can also extend PagerDefault using db_query and db_select. It's a pretty straight forward OOP. Here are a few examples: (api.drupal.org/comment/14994#comment-14994) (drupal.stackexchange.com/questions/40843/…)– rwaeryCommented Jul 24, 2014 at 13:41