I'd like to display the # (count) of Blogs on my quick tab menu. Ex: Blogs (3)
I found a way to overwrite the quicktab titles using the following function with an if statement
function mymodule_quicktabs_alter($quicktabs) {
if ($quicktabs->machine_name == 'quick_tab_front_page') {
$quicktabs->tabs = array(
0 => array(
'machine_name' => 'quick_tab_blogs',
'title' => 'BLOGS',
'weight' => '-100',
'type' => 'qtabs',
),
1 => array(
'machine_name' => 'quick_tab_news',
'title' => 'NEWS',
'weight' => '-89',
'type' => 'qtabs',
),
);
$quicktabs->renderer = 'quicktabs';
$quicktabs->style = 'Arrows';
$quicktabs->options = array();
}
}
I created a view, using the Views module, which contains all the blog titles written by a user.
Now I need to figure-out a way to display the views' count on the quick tab title
I have tried
function mymodule_quicktabs_alter($quicktabs) {
$view = views_get_view('user_blogs');
$view->set_arguments(array($account->uid));
$view->execute();
$count = count($view->result);
if ($quicktabs->machine_name == 'quick_tab_front_page') {
$quicktabs->tabs = array(
0 => array(
'machine_name' => 'quick_tab_blogs',
'title' => t('Blogs @count', array('@count' => $count));
but it gives me an error of Fatal error: Call to a member function execute() on a non-object for the line $view = views_get_view('user_blogs');
I don't get why, I am new to php.
views_get_view()
and also from where are you getting the$account
variable from.