您在這裡

利用jstools+views做出tab page

kiku's 的頭像
kiku 在 2007-09-12 (三) 22:53 發表

網路看來的
利用jstools+views做出tab page
Install the Views and JSTools module (JSTools 5.x-0.6 is best, as it allows multiple tabbed blocks on one page). Just upload and enable them.
Create whatever views you want. I'm using a super simple 'list view' for comments and my 'news' content type. Make a note of what these View names are.
Now, make a block and type the following:
<?php
//type the name of the first view here, where I've just got stars
$viewa = views_get_view('****');
$outputa = views_build_view('block', $viewa, array(), false,10);
//type the name of the second view here, where I've just got stars
$viewb = views_get_view('*****');
$outputb = views_build_view('block', $viewb, array(), false, 10);
//This bit makes the tabbed block
$form = array();
$form['tabset1'] = array(
'#type' => 'tabset',
);
$form['tabset1']['tab1'] = array(
'#type' => 'tabpage',
'#title' => t('Title 1'),
'#content' => $outputa,
);
$form['tabset1']['tab2'] = array(
'#type' => 'tabpage',
'#title' => t('Title 2'),
'#content' => $outputb,
);
return tabs_render($form);
?>