rootKID Posted February 18, 2015 Share Posted February 18, 2015 Hello! Been a while, but need help yet again I have started to use something called "Bootstrap Version 3" on my projects, going very good actually! Only problem whenever i get to my forum project, i get in trouble! They have this included "tab & pane" in the "Bootstrap V3", meaning like this W3Schools forum in the top-menu, they have links for forums, members, calender and so on... i wonna use something similar on my forum, only thing is that one HAS to be active, that i have understood in the Bootstrap project, whenever you arrive at the forum main-page? My idea is whenever a user has clicked on a tab, the forums related to that tab with the same ID will be shown right under there, this is my example: (PICTURES ATTACHED WITH DB TABLE INFORMATION & FORUM PRE-VIEW ETC IF NEEDED!) My code: $query = "SELECT * FROM mod_forums_forums_tabs";$result = $dbconn->query($query);if($result->num_rows > 0){ // TABS $HTMLOUT .= "<ul class='nav nav-tabs' role='tablist'>"; while($row = $result->fetch_assoc()) { //$HTMLOUT .= "<li role='presentation' class='active'><a href='#ACTIVE' role='tab' data-toggle='tab'>TAB TITLE</a></li>"; // Active //$HTMLOUT .= "<li role='presentation'><a href='#INACTIVE' role='tab' data-toggle='tab'>TAB TITLE</a></li>"; // Inactive $HTMLOUT .= "<li role='presentation'><a href='".$row['mfft_id']."' role='tab' data-toggle='tab'>".$row['mfft_name']."</a></li>"; } $HTMLOUT .= "</ul>"; // End "Tabs" // Break for space. $HTMLOUT .= "<br />"; $HTMLOUT .= "<div class='tab-content'>"; // PANES while($row = $result->fetch_assoc()) { //$HTMLOUT .= "<div role='tabpanel' class='tab-pane fade in active' id='ACTIVE'>Active</div>"; // Active //$HTMLOUT .= "<div role='tabpanel' class='tab-pane fade' id='INACTIVE'>Inactive</div>"; // Inactive $HTMLOUT .= "<div role='tabpanel' class='tab-pane fade' id='".$row['mfft_id']."'>Inactive</div>"; } $HTMLOUT .= "</div>"; // End "Panes"}else{ $HTMLOUT .= "<center>No forum-tabs made yet!</center>";} And yes! I am still working on it Not sure if you can see what i am trying to do here, but if you could give me some idea or tip that would be great! And ohh, about the active/inactive thing. My idea is to get the very FIRST tab that is inside the database to be active, and then WITH that id given from there show the panes down below as a start for until another tab has been clicked at, this is where my problem arrives? Hope you understood my ideas x) Hoping some sort of answers soon! Thanks alot in advance! PICTURE URL: http://www.mediafire.com/view/hru1obybjd06m0d/Overforums_DB.PNG http://www.mediafire.com/view/umh75if20a22lnb/Forums.PNG http://www.mediafire.com/view/04mbcwwwzhvz2vc/Tab_DB.PNG Thanks alot! Again! Link to comment Share on other sites More sharing options...
justsomeguy Posted February 18, 2015 Share Posted February 18, 2015 One issue is that you're trying to use 2 while loops to loop over the same result set without resetting the result set in between. The second while loop won't do anything because the result set cursor is already at the end of the result set from the first loop. You need to reset the result if you're going to loop through it again. Link to comment Share on other sites More sharing options...
rootKID Posted February 20, 2015 Author Share Posted February 20, 2015 so you are saying i need to "unset" the $result before using it again? Just to see if i understand what you are saying x) Thanks! Link to comment Share on other sites More sharing options...
Ingolme Posted February 20, 2015 Share Posted February 20, 2015 No, you don't need to unset it, you need to reset it. Set the pointer back to zero. You can do that using the data_seek() method. Link to comment Share on other sites More sharing options...
rootKID Posted February 23, 2015 Author Share Posted February 23, 2015 Hmm... thanks i guess.. but i have gone ahead to another temporary solution. Like before i'm going with a while loop inside a while loop to make the forums inside overforums. However the main idea WAS originally to only show the overforums that was going by ID in the database.. hence the tabs... not sure you understand what i'm trying to do Oo? In anyways, thanks! Will see if i can find a solution myself, else i will try to contact you again Thanks! Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now