Basically, I have an array of nids (node ids) stored in a $_SESSION variable, which is updated according to user actions (it holds a history of visited node pages). Now, I would like to create a view which displays a list of nodes, filtered by nids given in a $_SESSION variable.

For example:
if $_SESSION['my_nids'] == [1,5,6]
=> I want to display nodes 1,5,6 in the view.

Storing the nids in a db table is not an option due to performance reasons.

Can someone point me how to create such a non-database relationship views handler?


You can use the views php module. And you can get the $_SESSION['my_nids'] with in view. Actually you can do anything there that can be done with PHP.

Please note that this will again have a performance hit if the code is large. for simple things you go this route.


You can just make a normal views field handler but give it a key/machine name that isn't a database table. This is explained in the Views advanced help.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.