Hi folks,

I have the following code that I copied from another forum post.

                $myview = views_get_view('archive-block');
                $viewarg = "";
                //set the view argument $args[0] to your_variable before building the view
                $myview_args = array(0 => $viewarg);
                $myview_args = array();
                print views_build_view('block', $myview, $myview_args, false, 4);

But the above code is throwing the following error:

Call to undefined function views_build_view()

I actually created a archive view that I want to re-use based on the page context. I want to be able to pass parameter to my particular view.

Please help!

Thanks!

Comments

WorldFallz’s picture

a bit of googling located: http://drupal.org/node/99721#comment-887231

===
"Give a man a fish and you feed him for a day. Teach a man to fish and you feed him for a lifetime." - Lao Tzu
"God helps those who help themselves." - Ben Franklin
"Search is your best friend." - Worldfallz

faheemhameed’s picture

Thanks! for the info! Surprised, I was reading the same thread but missed out that particular comment...

WorldFallz’s picture

np... sometimes you just need a second pair of eyes. ;-)

===
"Give a man a fish and you feed him for a day. Teach a man to fish and you feed him for a lifetime." - Lao Tzu
"God helps those who help themselves." - Ben Franklin
"Search is your best friend." - Worldfallz