How to return the SQL Query code from any View?
I have been struggling for a few days after this
I need to return the SQL Query of a given view or from the current page
I finally figured out how, it is quite simple with only 2 lines of code:
$view = views_get_view('nomedaview'); // or views_get_page_view() for the current page view
$query_string = (string) $view->build_info[&query];
That's all !!!