0

I'm very new to drupal. I have successfully added a new menu Tab. And When I click on it, it shows a new page with the expected data.

However I would like:

  1. To have a "proper page" not just the unthemed view. How can I get the user page and assign my view to its main content ?
  2. Is there any way to make the menu "ajax" ?

So far I have:

function custom_user_page_callback()
{ 
  $view = views_get_view('activity_feed');
  $view->set_display('view_block_name');
  //$view->set_arguments(array($tid));
  $view->set_items_per_page(5);
  $view->pre_execute();
  $view->execute();

  // Here Instead of printing what shall I do ? 
  // like:
  // $page = drupal_get_page( user );
  // $page["main_content"] =  $view->render();
  print $view->render();
}



function custom_user_menu()
{      
    $items['user/%user/activity'] = array(
        'title' => 'Activity',
        'page callback' => 'custom_user_page_callback',
        'access arguments' => array('access content'), 
        'type' => MENU_LOCAL_TASK,
    );    
    return $items;
}
6
  • Quicktabs Aug 14, 2014 at 4:56
  • @J.Reynolds like this : drupal.org/node/1312406 ? Aug 14, 2014 at 5:37
  • Perhaps more like this: render quicktab programatically Aug 14, 2014 at 9:56
  • I am a little confused by your strategy. What is wrong with letting views display the view? Why the need for custom coding? I get the impression you want to create pages out of components, so rather look at Panels (and Panels Ajax Tabs). Aug 14, 2014 at 10:08
  • When [domain]/user is rendered, I would like to have the menu (the actual tab menu) to contains several user related tabs: Profile, Account, Blog Posts, Friends, Avatars ... does Quick Tab alter the menu? It will only allow me to put tab in the main content. Below the menu tabs? I'm gonna look a Panels modules. Aug 14, 2014 at 17:40

1 Answer 1

0

I get the impression you want to create pages out of components, so rather look at Panels (and Panels Ajax Tabs).

In order to use panels properly you have to learn how to use Page manager also as Panels integrates with it. The best online tutorials on that subject are from Johan Falk at Node One, Learn Page Manager! series. Tutorial 4 - 7 of that series deals specifically with Panels, but start at the beginning and work your way through it. You will also learn a lot about context which is an essential concept to master as a Drupal site builder.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.