By brooklynwebguy on
Hi --
I have created a block view for showing links to Story Nodes which are taxonomically related to the active page node.
This works fine except for one thing: The "Related News" header that I have specified in the view does not render when the view is embedded in the page although the related links do. Anyone know why this is happening?
Here is the code I am using:
$myview = views_get_view('related_news');
$myview_args = array(0 => 'MyTopic'); //set the the value for the taxonomy name filter
print views_build_view('block', $myview, $myview_args, false, 4);
Any advice on this would be most appreciated. I'm stumped.
Thanks
Comments
BTW
The reason I am not just putting in the title myself is that I don't want the title if there is nothing in the view. I like that when there is nothing in a view, no part of the view renders. I also don't want to write some code to check whether there is anything to display or not. I feel that displaying the view title during embedding is possible and that I simply don't know how to do it.
Titling an embedded view
I pulled up this, experiencing the same problem. I didn't figure it out, but created a satisfactory work around by just adding my title text into the header for the view, under the view's edit page (under page > header)
Here is one way that seems
Here is one way that seems to work ok.... I couldn't figure out where inside the views module it was setting the module and delta, and that views_view_block returns an array and theme('block', ...); requires an object seems weird. Although it does generate the block code as if it was enabled in a section in the Blocks admin.
Maybe it will help a little? Keep us posted if you find out anything...
I'm looking for the answer
I'm looking for the answer to this too - your block solution does help - but I can't persuade it to pass arguments as well (though it does if I simply enable it as a block - but then I can't position it where I need to)
Does anyone else have a solution which allows arguments and the title?