Tabs withinn tabs

Discuss everything related to ApPHP Tabs. Any questions related to the ApPHP Tabs developing or using should be posted to this forum.

Moderators: alexandrleonenko, Milton

stitcho
Junior
Junior
Posts: 11
Joined: Jul 28th, '11, 13:20

Tabs withinn tabs

Postby stitcho » Jul 28th, '11, 13:27

I am having a little trouble displaying a set of tabs within a page that has tabs on already.

Ok so I have the first page (supportal_wrapper.php) which contains the first set of tabs:

Code: Select all

<fieldset style="height:100%; width:100%; padding:0px; border:0px; margin-left:10px;">
      <?php
         define ("TABS_DIR", "");
         require_once(TABS_DIR.'tabs.class.php');
         $tabs = new Tabs();
         $tabs->SetId(1);
            //$tabs->Debug(true);
            $tabs->SetStyle($css_style);
             $tabs->SetSubmissionType($submission);
             $tabs->SetChildTabsType($child);
             $tabs->SetHttpVars(array("submission","style","child"));
         $tabs->AllowRefreshSelectedTabs(false);
         $tabs->UseAnchor(true);
         $tabs->CreateAnchorAuto(true);
   
            $linediagnostics=$tabs->AddTab("Diagnostic Information","Line_Diagnostics.php");
            $linetests=$tabs->AddTab("Diagnostic Tests","diagnostictests.php");
         $devicemanagement=$tabs->AddTab("Device Management","devicemanagement.php");         
         
            $tabs->SetDefaultTab($linediagnostics);
            $tabs->SetWidth("100%");
         $tabs->SetHeight("auto");
            $tabs->Display();
      ?>
      </fieldset>


I then have a page which sits inside the first tab called Line_Diagnostics.php. This Line_Diagnostics tab contain a load of HTML and PHP and another set of tabs at the bottom:

Code: Select all

<?php
         $tabs = new Tabs();
         $tabs->SetId(2);
         $tabs->AllowRefreshSelectedTabs(false);
         $tabs->UseAnchor(true);
         $tabs->CreateAnchorAuto(true);
                     
         $syncstatus=$tabs->AddTab("Sync Status","syncstatus.php");
            $authlogs=$tabs->AddTab("Auth Logs","authlogs.php");
         $cardstatus=$tabs->AddTab("Card Status","cardstatus.php");
         $speedtest=$tabs->AddTab("Speed Test","speedtest.php");
         $sessionstatus=$tabs->AddTab("Session Status","sessionstatus.php");
         $linehistory=$tabs->AddTab("Line History","linehistory.php");
         $dlm=$tabs->AddTab("DLM","dlm.php");
         $usagestats=$tabs->AddTab("Usage Stats","usagestats.php");
         
            $tabs->SetDefaultTab($syncstatus);
            $tabs->SetWidth("100%");
         $tabs->SetHeight("auto");
            $tabs->Display();
      ?>


Ok so the default page on the Line_Diagnostics displays no problem ($syncstatus). If I then click on one of the other tabs, $authlogs for example, I just get the animated loading image. I then cant click back on first tab and have to relead the page. If I change the default tab to $authlogs for example it displays the page no problem but I then cant navigate to other tabs.

So....in summary I can display the individual PHP pages if they are the default tab but cant change between them.

Thanks in advance for any help.

stitcho
Junior
Junior
Posts: 11
Joined: Jul 28th, '11, 13:20

Re: Tabs withinn tabs

Postby stitcho » Jul 28th, '11, 13:37

Just a quick addition. If I load Line_Diagnostics.php and add

Code: Select all

define ("TABS_DIR", "");
require_once(TABS_DIR.'tabs.class.php');

then the tabs work fine. If I then load that back into the supportal_wrapper.php I get the same problem and a new message saying tabs.class.php has already been defined.

administrator
Site Admin
Site Admin
Posts: 5997
Joined: Jan 7th, '09, 23:18
Contact:

Re: Tabs withinn tabs

Postby administrator » Jul 31st, '11, 09:28

Try to define constants in following way:

if(!defined('TABS_DIR')) define ("TABS_DIR", "");

Does it help now?

stitcho
Junior
Junior
Posts: 11
Joined: Jul 28th, '11, 13:20

Re: Tabs withinn tabs

Postby stitcho » Aug 1st, '11, 14:08

That helps with having the tabs.class.php defined on each page but it hasnt resolved the tabs not loading in the nested page.

stitcho
Junior
Junior
Posts: 11
Joined: Jul 28th, '11, 13:20

Re: Tabs withinn tabs

Postby stitcho » Aug 1st, '11, 14:12

Sorted it. I didnt have the following code defined on the nested page

Code: Select all

$tabs2->SetStyle($css_style);
             $tabs2->SetSubmissionType($submission);
             $tabs2->SetChildTabsType($child);
             $tabs2->SetHttpVars(array("submission","style","child"));
         $tabs2->AllowRefreshSelectedTabs(false);
         $tabs2->UseAnchor(true);
         $tabs2->CreateAnchorAuto(true);

stitcho
Junior
Junior
Posts: 11
Joined: Jul 28th, '11, 13:20

Re: Tabs withinn tabs

Postby stitcho » Aug 1st, '11, 15:33

Right now I have a new problem with my tabs....

Ok so the main page (supportal_wrapper.php) has 3 tabs on it - Diagnostic Information | Diagnostic Tests | Device Management

The content on Diagnostic Information tab loads fine and I can now use the tabs within this page. The problem I am now getting is when I navigate to the 2nd tab (Diagnostic Tests).

The Diagnostics Tests page is another wrapper page with no content except the following:

Code: Select all

<?php
if(!defined('TABS_DIR')) define ("TABS_DIR","");
require_once(TABS_DIR.'tabs.class.php');
         
$tabs3 = new Tabs();
$tabs3->SetId(3);
$tabs3->SetStyle($css_style);
$tabs3->SetSubmissionType($submission);
$tabs3->SetChildTabsType($child);
$tabs3->SetHttpVars(array("submission","style","child"));
$tabs3->AllowRefreshSelectedTabs(false);
$tabs3->UseAnchor(true);
$tabs3->CreateAnchorAuto(false);
   
$endusertest=$tabs3->AddTab("End User Test","endusertest.php");
$networktest=$tabs3->AddTab("Network Test","networktest.php");
$copperlinetest=$tabs3->AddTab("Copper Line Test","copperlinetest.php");         
         
$tabs3->SetDefaultTab($endusertest);
$tabs3->SetWidth("99%");
$tabs3->SetHeight("auto");
$tabs3->Display();
?>


When I try to click one of the tabs here (i.e. End User Test) the page goes back to the main first tab (Diagnostic Information). Does anyone know how to stop it from doing this and stay on the current tab (Diagnostic Tests).

I am assuming its something to do with Anchors but I dont know how to use them.

Thanks

administrator
Site Admin
Site Admin
Posts: 5997
Joined: Jan 7th, '09, 23:18
Contact:

Re: Tabs withinn tabs

Postby administrator » Aug 2nd, '11, 07:47

You have to use $tabs->SetHttpVars() method to store id of the clicked Tab when you navigate.

Example:
## *** set variables that used to get access to the page (like: my_page.php?act=34&id=56 etc.)
$tabs->SetHttpVars(array("id"));

stitcho
Junior
Junior
Posts: 11
Joined: Jul 28th, '11, 13:20

Re: Tabs withinn tabs

Postby stitcho » Aug 2nd, '11, 14:07

Thanks for the reply but I'm afraid some of this is new to me.

Ok so I have on every page $tabs->SetHttpVars(array("submission","style","child"));

My page structure is as follows:
Main Wrapper Page (supportal_wrapper.php). The default tab for this is Line_Diagnostics.php

Code: Select all

<?php
if(!defined('TABS_DIR')) define ("TABS_DIR","");
require_once(TABS_DIR.'tabs.class.php');
$tabs = new Tabs();
$tabs->SetId(1);
//$tabs->Debug(true);
$tabs->SetStyle($css_style);
$tabs->SetSubmissionType($submission);
$tabs->SetChildTabsType($child);
$tabs->SetHttpVars(array("submission","style","child","id"));
$tabs->AllowRefreshSelectedTabs(false);
$tabs->UseAnchor(true);
$tabs->CreateAnchorAuto(true);
   
$linediagnostics=$tabs->AddTab("Diagnostic Information","Line_Diagnostics?.php?id=1");
$linetests=$tabs->AddTab("Diagnostic Tests","diagnostictests.php?id=2");
$devicemanagement=$tabs->AddTab("Device Management","devicemanagement.php?id=3");         
         
$tabs->SetDefaultTab($linediagnostics);
$tabs->SetWidth("100%");
$tabs->SetHeight("auto");
$tabs->Display();
?>


So then I am going to my 2nd tab called Diagnostic Tests and have this code on that page (diagnostictests.php):

Code: Select all

<?php
if(!defined('TABS_DIR')) define ("TABS_DIR","");
require_once(TABS_DIR.'tabs.class.php');
      
$tabs3 = new Tabs();
$tabs3->SetId(3);
$tabs3->SetStyle($css_style);
$tabs3->SetSubmissionType($submission);
$tabs3->SetChildTabsType($child);
$tabs3->SetHttpVars(array("submission","style","child","id"));
$tabs3->AllowRefreshSelectedTabs(false);
$tabs3->UseAnchor(true);
$tabs3->CreateAnchorAuto(true);
   
$endusertest=$tabs3->AddTab("End User Test","endusertest.php");
$networktest=$tabs3->AddTab("Network Test","networktest.php");
$copperlinetest=$tabs3->AddTab("Copper Line Test","copperlinetest.php");         
         
$tabs3->SetDefaultTab($endusertest);
$tabs3->SetWidth("99%");
$tabs3->SetHeight("auto");
$tabs3->Display();
?>


So on supportal_wrapper.php my default page is Line_Diagnostics.php. If I click on the Diagnostic Tests tab it takes me to the diagnostictests.php page. This works fine and the URL ends up as http://localhost:8080/supportal/support ... r.php#tabs.

If I then click one of the tabs on the diagnostictest.php page (for example networktest.php) it takes me back to the Line_Diagnostics.php page and puts this in the URL - http://localhost:8080/supportal/support ... ?id=2#tabs

Can anyone suggest where I am going wrong?

administrator
Site Admin
Site Admin
Posts: 5997
Joined: Jan 7th, '09, 23:18
Contact:

Re: Tabs withinn tabs

Postby administrator » Aug 3rd, '11, 07:13

Can you please upload your script on any shared hosting, so we could check it visually?
It's very hard to understand what your problem is from the textual description.

stitcho
Junior
Junior
Posts: 11
Joined: Jul 28th, '11, 13:20

Re: Tabs withinn tabs

Postby stitcho » Aug 3rd, '11, 07:50

Thanks for your assistance. I have uploaded the pages here - www.stitchmedia.co.uk/supportal.zip

Use supportal_wrapper.php as your index page.

Thanks


Return to “ApPHP Tabs”