Get view block by view name

This is a simple function to grab a View block by view name.

Usage:

my_get_view_block("my_view_name");

Code:

function my_get_view_block($viewname = NULL){
if(!empty($viewname)){
# from View name, i got the view ID
$vid = db_result(db_query('SELECT vid FROM {view_view} WHERE name = "%s"',$viewname));
# read related comments for views_view_block on view.module
$block = views_view_block($vid);
return $block;
}
else
return FALSE;
}

0 Responses to “Get view block by view name”



  1. No Comments Yet

Leave a Reply




IE6: Rust in Peace

Blog Stats

  • 78,142 hits
My Bookshelf

Texts double licensed under Creative Commons Attribution - Share Alike license and GNU Free Documentation License. Examples may contain software licensed under GNU General Public License. Images and comments texts aren't necessarily licensed under these terms.