Get view block by view name

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




function my_get_view_block($viewname = NULL){
# 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;
return FALSE;

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.

%d bloggers like this: