I would really like to:
to create a paginated table of nodes, displaying only those that the user has 'update' permission to; displaying title, content type, and path alias
the path for nodes may be different depending on the content type. More specifically, I have created a content type 'file' to wrap an uploaded file; I would like to display the url alias associated to the actual file, rather than the url alias of node that wraps it.
There are a few approaches that I have considered,
Creating views. However, the above behavior seems to require merging two views --- one for nodes of type file, one for node of content type not equal to file. I have no idea how to merge two views. Also, this method seems to create a dependency of the output of the view on the content type 'file'.
Use database query + pagination. In many of the examples that I have seen, if I want to add pagination to a table, I can do the following (see this very excellent tutorial):
- run a database query using either
pager_query
or theextend
method for theSelectQuery
object - theme the query results, and use theme to generate the pager based on the query
The problem with this approach is making theme('pager') play well with filtering the database entries by node_access. For example, for an user with relatively few nodes that she can edit, the table displays many empty pages.
- run a database query using either
Database query, filter into array, then use pagination on array as suggested by this post. This does get the table to work correctly. However, it is really expensive, because the entire query is run at this point, and the pager is purely for aesthetic purposes; seems a bit wasteful.
Now (thank you for bearing with me so far), is there a some way to create this table this without using views, but faster than method 3? I can also accept 'no' for an answer; in this case, it would be nice to know why not.