Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
can quick tabs be used for normal pages as well ?
current iam using it like this
quick tab block shows only if page is "book1" and location of quick tab block is set in the center
its the quicktab block which does all the pulling of data from all over the place and displays them within each tab
the actual "book1" node shows up only very little content
so it seems like the quicktab block IS the content for book1
Comments
Comment #1
Pasqualleif php format is enabled for the node, then you can insert quicktabs like this:
you can even create the quicktabs dynamically, for example:
so you don't need to place the quicktabs block to any region.. does it answer your question?
maybe using an insert_quicktabs module (not exists yet) would be easier
EDIT: this example does not work correctly in ajax mode, change the identifier to 'anyuniqueid'. Do not use hyphens in qtid till this issue is not fixed #449628: Programmatically Create Quicktabs $quicktabs['qtid'] cannot contain dashes
Comment #2
dropchew CreditAttribution: dropchew commentedHi,
I have created an issue http://drupal.org/node/345581 regarding arguments in ajax. Thanks
Comment #3
Pasquallecreate a book page about "render quicktab programatically" from these examples
Comment #4
Woggers CreditAttribution: Woggers commentedCan you please expand on this? I have created a quicktab programmatically in a module i've written but when executing
$content = theme('quicktabs', $quicktabs) I keep getting a NULL result?
Comment #5
PasqualleI need to know what you have in the $quicktabs variable to be able to help you..
This simple example should always work in a node with PHP input format:
Comment #6
Igbonine CreditAttribution: Igbonine commentedDoes this include drupal 5.x
Comment #7
Pasqualle@ezunkwelle: no. This works only with 6.x-2.0 (and above)
Comment #8
bartclarkson CreditAttribution: bartclarkson commentedI found it necessary to start out the code snippets above with
$tabs = array();
Without typing the $tabs, I received warnings and breakage.Comment #9
Pasqualleas I know, if you define one element in the array then it is an array, so I don't understand why do you have to specially define it..
Comment #10
aharown07 CreditAttribution: aharown07 commentedCode in #1 works fine for me
Comment #11
Pasqualleimportant note: "freetext" type tab does not work with ajax quicktab, it is not possible.
Comment #12
Pasquallefor the original question. other options to display quicktab in one node:
1. if PHP input format is not enabled you can use the Insert Block module
2. create a theme template file page-node-42.tpl.php (or other template file options: http://drupal.org/node/190815), and insert the PHP snippet (#1) into that file (EDIT: this is not wrong, see comment #13)
Comment #13
Pasquallethis script mostly does not work inside page.tpl.php and page-*tpl.php templates as quicktabs needs additional js and css files. (this problem is not Quick Tabs specific, same applies for example for Views) Calling drupal_add_css() or drupal_add_js() from page.tpl.php has no effect..
So if you really need to render quicktabs inside page.tpl.php you need to add the required files manually.. As it is hard to list all the required css and js files, the better option would be to make the quicktab rendering inside the preprocess function..
you can do it in theme's template.php file
now, in your page.tpl.php you can use
print $myquicktab;
Comment #14
Anonymous (not verified) CreditAttribution: Anonymous commentedI try to render the quicktabs in a node using the example #1.
I can't get it to load bloack using this example;
I think I got the block_id's wrong. Is that supposed to be the ID I see when I edit a block, ore the ID I find in the database (BID). Both don't seem to work.
Comment #15
PasqualleRe #14
oh, that is not that simple. That id is really wrong in quicktabs. (I should have fixed that long time ago. Maybe in the 3.x version.)
format: $module_delta_$bid
example: "user_delta_3" should be the "Who's online" block..
Comment #16
Anonymous (not verified) CreditAttribution: Anonymous commented@ Pasqualle, Thanks for your fast reply. You made my day!!
You can see it in action at www.zookah.com at the homepage.
Thanks!!
Comment #17
PasqualleYou are welcome. That page is a nice usage example of quicktabs..
Those login boxes should check additional settings and permissions. For example the Register tab should not be displayed if you disable registration.. But you may easily add that logic as you created the tabs programatically, maybe you already done that..
Comment #18
askit CreditAttribution: askit commentedI use the codes in #1 in a block (rather than in a node). Each tab refers to some other standard blocks. The codes generate the tabs but there are no contents for the tab.
Anything I shall revise if the codes are used in a block?
Comment #19
Pasqualle@askit: can you show a snippet from the code? Did you name the bid correctly, as described in comment #15?
Comment #20
lifter035 CreditAttribution: lifter035 commentedHi Pasqualle,
Thanks for all the help here. I have one question.
This is how I add tab for example free text type
I'm trying to nest few quicktabs into other quicktab instance.
Is this correct way? It doesn't seem to do anything.
Thanks a million,
Eddie
Comment #21
lifter035 CreditAttribution: lifter035 commentedJust so we don't go back and forward I'm getting some data from view and trying to populate three tabs with nested tabs.
This is the code I'm using:
I changed 'type' => 'quicktabs' to 'type' => 'qtabs' looking at the module code.
I tried to print quicktabs genrated by view results and they display ok but they won't nest into the bottom one.
Can't figure out why is this not working :)
Please help
Thanks,
Eddie
Comment #22
PasqualleThe problem is that 'qtabs' type works only with quicktabs stored in the database..
Try to change the last quicktab like this:
Comment #23
lifter035 CreditAttribution: lifter035 commentedThanks a lot man :)
You made my day. It's working perfect.
Ed
Comment #24
askit CreditAttribution: askit commentedHi Pasqualle, thank you for the hints on block id - that's the cause. I used "block-og-0" (group detail block). QuickTabs works when I change block id to "og_delta_0". Thank you so much!
Comment #25
featherbellyHello,
I am trying to get some quicktabs containing full nodes to render programatically. The node has children (using node hierarchy) and I want to display one of each content type (if present).
The problem is I would like to use AJAX but as soon as I set $quicktabs['ajax'] = TRUE then only the first tab displays the full node and the rest display teasers only...
Is there anything you can see that I'm doing wrong? Thanks in advance.
Comment #26
Pasqualle@featherbelly: yes, I can confirm the problem. this is some kind of php weirdness..
use:
that works..
Comment #27
design.er CreditAttribution: design.er commentedThanks a lot for the hints in #1. I also read the samples from #21 and tried to reproduce this but failed.
How can I call an existing QuickTab inside a QTab or nest it also programmatically tab by tab inside a QuickTab?
Example:
Tab 1: Info (type: view. works fine)
Tab 2: Media (type: freetext?)
-> Pictures (type: view. How to nest this view inside 'Tab 2: Media' ?)
-> Podcasts (type: view. Here the same questions)
Tab 3: Another info (type: view)
Here my attempt:
Thanks a lot for your help. :)
Kind regards,
Stefan
Comment #28
Pasquallethis should work:
Comment #29
design.er CreditAttribution: design.er commentedAwesome, it works! :) Thank you VERY MUCH! :)
Comment #30
SocialNicheGuru CreditAttribution: SocialNicheGuru commentedi have added a block to a quicktab
now i want to theme that block by changing view-view--...tpl.php file.
Now if I don't change the file, the raw data shows up under the tab
If I do change the file then none of the variables are passed down to the view.
Am I doing something strange/wrong?
Comment #31
Pasqualle@activelyOUT:
you have added a block but theming a view? this does not make sense..
why do you see raw data? every view should be themed by default..
passing variables to view and changing the view's template file has no relation..
why did you posted the question in this issue? I do not see anything related in your comment..
please provide more information..
Comment #32
SocialNicheGuru CreditAttribution: SocialNicheGuru commentedI started a new issue
http://drupal.org/node/575852#comment-2036146
Comment #33
juicytoo CreditAttribution: juicytoo commentedjust a comment.
I was using the following to display QT within nodes
Which is better?
cheers
Comment #34
dropchew CreditAttribution: dropchew commentedHi juicytoo,
I happened to came across that issue and had tried using devel to compare the performance. Both approach have the same no. of queries and not much diff in time rendering. Maybe other members have a different view on this...
Comment #35
PasqualleRe #33
There is a slight difference between the two:
The first retrieves the quicktab as block, with block title and block content. And you display the block content only.
The second retrieves the quicktab directly.
but if you look into quicktabs_block() function you can see that there is only one step between the first and the second solution.
I would prefer the second, as when I am displaying the quicktab programatically I never need it themed as a block.
Comment #36
CinemaSaville CreditAttribution: CinemaSaville commentedHi. This is a fantastic solution, and I got the tabs working in with the php method in the node, my only issue is that if I have a pager for the 2nd or 3rd etc. tab, every time it pages over the first tab appears again thus confusing the user, even though the next page is available when they click the preferred tab. Is there any way to alleviate this issue by keeping the preferred tab visible when the page is clicked? Or is there perhaps a better way of moving the pages over with jquery or something like that. Thanks again. This module rocks!
Comment #37
Pasqualle@CinemaSaville: I think you are looking for this issue: #248798: Tab reset with page load.
Comment #38
rc2020 CreditAttribution: rc2020 commentedsubscribing
Comment #39
jdwfly CreditAttribution: jdwfly commentedCreate book page at http://drupal.org/node/679148. This was helpful to me and I figured there are many others that would like to know as well.
Please review and update accordingly if I missed something.
Comment #41
Arkrep CreditAttribution: Arkrep commentedThanks Pasqualle..
Just wanted to add for all the other newbies out, make sure you flush the site cash to get this to work.
Steve
Comment #42
ivashrestha CreditAttribution: ivashrestha commentedHi all,
The quicktabs freetext option didn't work for me when ajax was enabled.
Is there a work around for that. Also even when the ajax is not enabled having more that 2 freetext tabs doesnot work. The first 2 tabs works fine but the third and the others after that doesnot show content at all. Have anyone come across same problem??
Comment #43
Pasqualle@ivashrestha: read comment #11
Comment #44
babusaheb.vikas CreditAttribution: babusaheb.vikas commentedI was trying to create quick tab dynamically for drupal 7 and i read so many thread or post . I looked into module and found the code to create it dynamically on page
Put above code in any page and it would create tabs dynamically.
Please mind changing the $qtname = 'test2qtab'; put your qtname here.
Comment #45
japerryIt seems that upgrading from 2.x to 3.x has caused blocks to be hidden even when the block is selected...
//set tab content
$tabs['first'] = array(
'title' => t('First'),
'type' => 'block',
'bid' => 'my_block_delta_first',
'hide_title' => TRUE,
);
$tabs['second'] = array(
'title' => t('Second'),
'type' => 'block',
'bid' => 'my_block_delta_second',
'hide_title' => TRUE,
);
$tabs['third'] = array(
'title' => t('Third'),
'type' => 'block',
'bid' => 'my_block_delta_third',
'hide_title' => TRUE,
);
$quicktabs['qtid'] = 'page_details'; // machine readable name
$quicktabs['hide_empty_tags'] = TRUE; // hide tabs that are empty
$quicktabs['default_tab'] = 'stats'; // set the default tab
$quicktabs['tabs'] = $tabs; // all tabs with content
$quicktabs['style'] = 'default'; // tabs theme
$quicktabs['ajax'] = FALSE; // ajax or not
$block = array('subject' => '', 'content' => theme('quicktabs', $quicktabs));
return $block;
break;
Comment #46
andes1 CreditAttribution: andes1 commentedI am working with Quicktabs on Drupal 7 and i want my quicktabs on page.tpl.php or page--mypage.tpl.php.
I write code on template.php :
and on page.tpl.php :
<?php print $myquicktab; ?>
still i am not getting the quicktabs. i can get the whole array if i print $get_quicktabs. but not along with theme.
could not check why its not working?
Comment #47
jdwfly CreditAttribution: jdwfly commentedPlease open new issue for help @active_cyber. This issue was fixed when the documentation was created.
Comment #48
Pasquallefor Drupal 7 try:
qt from database; (http://drupal.org/node/679148#comment-4712456)
qt from code:
see quicktabs_build_quicktabs() function for more details..
Comment #49
bserem CreditAttribution: bserem commented#44 and #48 were quite helpfull in adding a Quicktab programmatically in D7 and QT3
I am having troubles displaying a node or another quicktab inside one of the tabs however. Is this possible programmaticaly or only text is available?
Comment #50
Steve Dondley CreditAttribution: Steve Dondley commentedWhat's the easiest way to grab the quicktabs ID. Query the database?
Comment #51
Steve Dondley CreditAttribution: Steve Dondley commentedDisregard last. It's not a numerical id but the machine name of the quicktab.
Comment #52
jbova CreditAttribution: jbova commented@bserem,
You may show a node, view, or block inside of a quicktab by changing the type. I'm unsure about nesting quicktabs. Here is an example showing four tabs that each load a distinct view.
The "type" key must be set to "view". The "vid" key is the view id. The "display" key is the id of the display in your view. The "args" key are any optional arguments that your view may expect. If you want to style the quicktab, the id of the div container will be quicktabs-$qtname. So, in this example, the id is quicktabs-commerce_product.
Here is an example of a loading a node and block into quicktabs:
Comment #53
eliasdelatorre CreditAttribution: eliasdelatorre commentedAt the comment #14:
I guess it will make the code clearer to set the format as:
given that the blocks table has a bid field and a delta field, delta is the one with the name of the block.
So for example, I created a new box (a box is the same as a block, just that a box can be exported on a feature) and I want to put that block into a tab, I went to MySQL and selected all the fields, and my result was:
So my 'bid' field should be:
'bid' => 'boxes_delta_sponsor_home',
Cheers!
Comment #54
jackbravo CreditAttribution: jackbravo commentedIn case you have trouble displaying the tabs in D7, be sure to include the 'args' parameter for views, even if it is empty.
Comment #55
rudetrue CreditAttribution: rudetrue commentedThank you #44, that was the only example I've found that is working to add quick-tabs to a node template and render fields inside of them. Your post saved me a lot of time and monotonous work.
Comment #56
foagth CreditAttribution: foagth commentedYou nailed it @eliasdelatorre at #53. I was close but you gave the crystal clear explanation.
I was trying to find where the actual integer 'bid' from the db should go.
Comment #57
mattrweaver CreditAttribution: mattrweaver commentedThanks eliasdelatorre, this explains it, and I finally sorted out my block id!
Comment #58
lameei CreditAttribution: lameei commentedHere is My case:
I have a Quicktab with 2 tabs. The block is placed in user profile. Now I want to show one of the blocks only when the user visits his own profile and hide it when he is visiting other profiles. How may I do this?