1

I hav a strange task where I need to pull the content from a (well some) drupal view into an array so I can use that data later. I dont want to display contents right away, but I'll need to access it later.

I have already built the view but it was suggested that I can export the view and then create a module to grab the view data but I have no idea how to do that.

Basically what Im doing, is creating a view to pull say, 9 records of node type "blog" and on the front page, I want to pull that view, throw the results into a json array, and then do stuff with it later.

3

Not sure if it's what you're looking for, but if you're using a template to display that view, you can access an array of the view data by using the php code

$view->style_plugin->rendered_fields;

This will give you an array of everything that the view has returned.

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.