Posted by robertdouglass on May 31, 2006 at 3:51pm
I want to get my hands on the query that gets called to generate a view. Possible after calling views_get_view?
I want to get my hands on the query that gets called to generate a view. Possible after calling views_get_view?
Comments
Instead of using
Instead of using views_build_view('page', ...) and then views_pre_view() you could call views_build_view('result', ....) which stops before generating the view itself and returns an $info array that has the final query and a $result object you can use db_fetch_object() on.
Wicked!
Thanks Karen =)
Same code?
Could I get some same code?
I've done this and it's still not working?
<?php$view_name= 'available'; //name of view
$view_args= array();
$view= views_get_view($view_name);
$view_object= views_build_view('result', $view, $view_args, FALSE);
$skills= db_fetch_object($view_object['query'])
print_r($skills);
?>
Sorry, the $query object is
Sorry, the $query object is destroyed by the time views_build_view() returns. You won't be able to retrieve it from the outside.