Need help with Tabbed Menu

  Post new topicReply to topicPrintable Version
<< View previous topic View next topic >>
Share: Del.icio.us  Digg  Google  Spurl  Blink  Furl  Y! MyWeb  
#1   Need help with Tabbed Menu
Donovan
CZ Active Member
 Codezwiz Site Donator
Donovan has been a member for over 20 year's 20 Year Member
usa.gif ohio.gif
Occupation: Web Developer
Gender: Male
Fav. Sports Team: St Louis Cardinals
Status: Offline
Joined: Dec 03, 2003
0.02 posts per day
Posts: 160
Points: 9,216
   
A new module I'm making for my kids swim team. I wanted a tabbed menu to list Roster, Records, Coaches and the like across the top of a page.

I have used this tabmenu() before however it was in an admin/index.php page and wanted to replicate it here in my index.php (public) page but so far am getting a blank page. I turned error reporting on but still see nothing.

Maybe someone can see what is wrong with this index.php

AFAIK the "Information" panel should be the one that is viewed first.
[ Register or login to view links on this board. ]


From what I can tell my switch($op) { should work and send the page to the default panel. It send it to function swim_menu($panel) {
with the argument of "Information"

Which should then call the information function here

if ($panel=="Information"){$panstyle="";}else{$panstyle="style=\"display: none\"";}
    echo "<div class=\"panel\" id=\"panel1\" $panstyle>";
    information(); 


All I get is a blank page with my header showing.


Back to top Reply with quote
#2   
Telli
Site Admin
Occupation: Self Employed
Age: 46
Gender: Male
Fav. Sports Team: Detroit Red Wings
Website:
Status: Offline
Joined: May 26, 2003
1.03 posts per day
Posts: 8089
Points: 494,440
   
Do you have error reporting on? Blank page sounds like a PHP error.

I also noticed you have include("footer.php"); in each function but then you also have it in the menu function which calls each of those functions, so your footer is being included twice.




_________________
The path of the righteous man is beset on all sides by the inequities of the selfish and the tyranny of evil men. Blessed is he, who in the name of charity and good will, shepherds the weak through the valley of darkness, for he is truly his brother's keeper and the finder of lost children. And I will strike down upon thee with great vengeance and furious anger those who would attempt to poison and destroy my brothers. And you will know my name is the Lord when I lay my vengeance upon thee. Ezekiel 25:17
Back to top Reply with quote
#3   
Donovan
CZ Active Member
 Codezwiz Site Donator
Donovan has been a member for over 20 year's 20 Year Member
usa.gif ohio.gif
Occupation: Web Developer
Gender: Male
Fav. Sports Team: St Louis Cardinals
Status: Offline
Joined: Dec 03, 2003
0.02 posts per day
Posts: 160
Points: 9,216
   


Originally posted by Telli @ Sat Jul 19, 2008 4:14 pm:

Do you have error reporting on? Blank page sounds like a PHP error.



error_reporting(E_ALL);



Originally posted by Telli @ Sat Jul 19, 2008 4:14 pm:


I also noticed you have include("footer.php"); in each function but then you also have it in the menu function which calls each of those functions, so your footer is being included twice.


I'll fix this.

Other than that I think this should work.



Back to top Reply with quote
#4   
Donovan
CZ Active Member
 Codezwiz Site Donator
Donovan has been a member for over 20 year's 20 Year Member
usa.gif ohio.gif
Occupation: Web Developer
Gender: Male
Fav. Sports Team: St Louis Cardinals
Status: Offline
Joined: Dec 03, 2003
0.02 posts per day
Posts: 160
Points: 9,216
   
I also removed the @ as it was repressing errors.


//Required Files
include("header.php");
$module_name = basename(dirname(__FILE__));
get_lang($module_name);
global $module_name, $db, $prefix, $bgcolor1, $bgcolor2;


Still no luck. icon_sad.gif


Back to top Reply with quote
#5   
Telli
Site Admin
Occupation: Self Employed
Age: 46
Gender: Male
Fav. Sports Team: Detroit Red Wings
Website:
Status: Offline
Joined: May 26, 2003
1.03 posts per day
Posts: 8089
Points: 494,440
   
Erase the last panel from the array (panel9), its not used. Also you have to add the panel8 div when the javascript runs through the loop it isn't finding it and throwing up an error.



<?php

/************************************************************************
* Idle Hour Swim Team Module
* By: Steve Donovan
* http://www.idlehourswimteam.org
* Copyright © 2007 by Idle Hour Swim Club
* License: GNU/GPL
************************************************************************/

if (!defined('MODULE_FILE')) {
    die ("You can't access this file directly...");
}
require_once('mainfile.php');
//error_reporting (E_ALL|E_STRICT);
error_reporting(E_ALL);

define('INDEX_FILE', TRUE);
$index = 1;

//Required Files
@include_once("header.php");
$module_name = basename(dirname(__FILE__));
@get_lang($module_name);
global $module_name, $db, $prefix, $bgcolor1, $bgcolor2;


function tabmenu(){
    global $prefix, $db, $bgcolor2, $bgcolor3;
echo "
<style type=\"text/css\">
     a.tab {
        border-collapse: collapse;
        border-style: solid solid none solid;
        border-color: $bgcolor2;
        border-width: 1px 1px 0px 1px;
        background-color: $bgcolor2;
        padding: 2px 0.5em 1px 0.5em;
        margin-top: 4px;
        font-family: arial;
        text-decoration: none;
      }
          a.tab2 {
        border-collapse: collapse;
        border-style: solid solid solid solid;
        border-color: $bgcolor2;
        border-width: 1px 1px 1px 1px;
        background-color: $bgcolor2;
        padding: 2px 0.5em 1px 0.5em;
        margin-top: 4px;
        font-family: arial;
        text-decoration: none;
      }
      a.tab:hover {
        border-color: $bgcolor2;
        background-color: $bgcolor3;
      text-decoration: none;
       text-decoration: bold;
      }
      a.tab2:hover {
        border-color: $bgcolor2;
        background-color: $bgcolor3;
      text-decoration: none;
       text-decoration: bold;
      }
      .panel { border: solid 1px $bgcolor2; background-color: $bgcolor1; padding: 5px; height: 300px; overflow: none;
     text-decoration: none;}
    </style>";
   ?>
    <script type="text/javascript">
      var panels = new Array('panel1', 'panel2', 'panel3', 'panel4', 'panel5', 'panel6', 'panel7', 'panel8');
      var selectedTab = null;
      function showPanel(tab, name)
      {
        if (selectedTab)
        {
          selectedTab.style.backgroundColor = '<? echo"$bgcolor2";?>';
          selectedTab.style.paddingTop = '';
          selectedTab.style.paddingBottom = '2px';
        }
        selectedTab = tab;
        selectedTab.style.backgroundColor = '<? echo"$bgcolor3";?>';
        selectedTab.style.paddingTop = '4px';
        for(i = 0; i < panels.length; i++)
        {
          document.getElementById(panels[i]).style.display = (name == panels[i]) ? 'block':'none';
        }
        return false;
      }
    </script>
<?php
}

/**********************************
*  Swim Team Menu
***********************************/

function swim_menu($panel) {
    global $prefix, $db, $bgcolor2, $bgcolor3;
   tabmenu();
    include("header.php");
    OpenTable();
    echo "<center><strong>Idle Hour Swim Team</strong></center><br>";
   echo "<a href=\"#\" class=\"tab\" onclick=\"return showPanel(this, 'panel1');\" STYLE=\"text-decoration:none\"><img src=\"modules/Swim_Team/images/folder.gif\" width=\"10\" height=\"10\" border=\"0\">Information</a>";
    echo "<a href=\"#\" class=\"tab\" onclick=\"return showPanel(this, 'panel2');\" STYLE=\"text-decoration:none\"><img src=\"modules/Swim_Team/images/folder.gif\" width=\"10\" height=\"10\" border=\"0\"> Team Roster</a>";
    echo "<a href=\"#\" class=\"tab\" onclick=\"return showPanel(this, 'panel3');\" STYLE=\"text-decoration:none\"><img src=\"modules/Swim_Team/images/folder.gif\" width=\"10\" height=\"10\" border=\"0\"> Team Records</a>";
   echo "<a href=\"#\" class=\"tab\" onclick=\"return showPanel(this, 'panel4');\" STYLE=\"text-decoration:none\"><img src=\"modules/Swim_Team/images/folder.gif\" width=\"10\" height=\"10\" border=\"0\"> Pool Records</a>";
   echo "<a href=\"#\" class=\"tab\" onclick=\"return showPanel(this, 'panel5');\" STYLE=\"text-decoration:none\"><img src=\"modules/Swim_Team/images/folder.gif\" width=\"10\" height=\"10\" border=\"0\"> Swim Meets</a>";
    echo "<a href=\"#\" class=\"tab\" onclick=\"return showPanel(this, 'panel6');\" STYLE=\"text-decoration:none\"><img src=\"modules/Swim_Team/images/folder.gif\" width=\"10\" height=\"10\" border=\"0\"> Coaches</a>";
    echo "<a href=\"#\" class=\"tab\" onclick=\"return showPanel(this, 'panel7');\" STYLE=\"text-decoration:none\"><img src=\"modules/Swim_Team/images/folder.gif\" width=\"10\" height=\"10\" border=\"0\"> Board Members</a>";
   echo "<a href=\"#\" class=\"tab\" onclick=\"return showPanel(this, 'panel8');\" STYLE=\"text-decoration:none\"><img src=\"modules/Swim_Team/images/folder.gif\" width=\"10\" height=\"10\" border=\"0\"> Join the Team</a>";

   if ($panel=="Information"){$panstyle="";}else{$panstyle="style=\"display: none\"";}
   echo "<div class=\"panel\" id=\"panel1\" $panstyle>";
   information();
   echo "</div>";
   if ($panel=="Roster"){$panstyle="";}else{$panstyle="style=\"display: none\"";}
   echo "<div class=\"panel\" id=\"panel2\" $panstyle>";
   roster();
   echo "</div>";
   if ($panel=="Team Records"){$panstyle="";}else{$panstyle="style=\"display: none\"";}
   echo "<div class=\"panel\" id=\"panel3\" $panstyle>";
   team_records();
   echo "</div>";
   if ($panel=="Pool Records"){$panstyle="";}else{$panstyle="style=\"display: none\"";}
   echo "<div class=\"panel\" id=\"panel4\" $panstyle>";
   pool_records();
   echo "</div>";
   if ($panel=="Swim Meets"){$panstyle="";}else{$panstyle="style=\"display: none\"";}
   echo "<div class=\"panel\" id=\"panel5\" $panstyle>";
   swim_meets();
   echo "</div>";
   if ($panel=="Coaches"){$panstyle="";}else{$panstyle="style=\"display: none\"";}
   echo "<div class=\"panel\" id=\"panel6\" $panstyle>";
   coaches();
   echo "</div>";
   if ($panel=="Board Members"){$panstyle="";}else{$panstyle="style=\"display: none\"";}
   echo "<div class=\"panel\" id=\"panel7\" $panstyle>";
   board_members();
   echo "</div>";
   if ($panel=="Join the Team"){$panstyle="";}else{$panstyle="style=\"display: none\"";}
   echo "<div class=\"panel\" id=\"panel8\" $panstyle>";
   join_team();
   echo "</div>";
   CloseTable();
   echo "<br>";
   echo "<br>";
    include("footer.php");
}

/**********************************
*  Information
***********************************/

function information() {
    global $prefix, $db, $bgcolor2, $bgcolor3;
   tabmenu();
   echo"<table border=\"1\" width=\"100%\" cellpadding=\"3\">";
   echo"<tr>"
   ."<td>Information Under Construction</td>"
   ."</tr>"
   ."</table>";
}


/**********************************
*  Team Roster
***********************************/

function roster() {
   global $prefix, $db, $bgcolor2, $bgcolor3;
   tabmenu();
   echo"<table border=\"1\" width=\"100%\" cellpadding=\"3\">";
   echo"<tr>"
   ."<td>Roster Under Construction</td>"
   ."</tr>"
   ."</table>";
}

/**********************************
*  Team Records
***********************************/

function team_records() {
   global $prefix, $db, $bgcolor2, $bgcolor3;
   tabmenu();
   echo"<table border=\"1\" width=\"100%\" cellpadding=\"3\">";
   echo"<tr>"
   ."<td>Team Records Under Construction</td>"
   ."</tr>"
   ."</table>";
}

/**********************************
*  Pool Records
***********************************/

function pool_records() {
    global $prefix, $db, $bgcolor2, $bgcolor3;
   tabmenu();
   echo"<table border=\"1\" width=\"100%\" cellpadding=\"3\">";
   echo"<tr>"
   ."<td>Pool Records Under Construction</td>"
   ."</tr>"
   ."</table>";
}

/**********************************
*  Swim Meets
***********************************/

function swim_meets() {
    global $prefix, $db, $bgcolor2, $bgcolor3;
   tabmenu();
   echo"<table border=\"1\" width=\"100%\" cellpadding=\"3\">";
   echo"<tr>"
   ."<td>Swim Meets Under Construction</td>"
   ."</tr>"
   ."</table>";
}

/**********************************
*  Coaches
***********************************/

function coaches() {
    global $prefix, $db, $bgcolor2, $bgcolor3;
   tabmenu();
   echo"<table border=\"1\" width=\"100%\" cellpadding=\"3\">";
   echo"<tr>"
   ."<td>Coaches Under Construction</td>"
   ."</tr>"
   ."</table>";
}

/**********************************
*  Board Members
***********************************/

function board_members() {
    global $prefix, $db, $bgcolor2, $bgcolor3;
   tabmenu();
   echo"<table border=\"1\" width=\"100%\" cellpadding=\"3\">";
   echo"<tr>"
   ."<td>Board Members Under Construction</td>"
   ."</tr>"
   ."</table>";
}

/**********************************
*  Board Members
***********************************/

function join_team() {
    global $prefix, $db, $bgcolor2, $bgcolor3;
   tabmenu();
   echo"<table border=\"1\" width=\"100%\" cellpadding=\"3\">";
   echo"<tr>"
   ."<td>Join Team Under Construction</td>"
   ."</tr>"
   ."</table>";
}


switch($op) {

       default:
         swim_menu('Information');
      break;

      case "roster":
         swim_menu('Roster');
         break;

      case "team_records":
         swim_menu('Team Records');
         break;

      case "pool_records":
         swim_menu('Pool Records');
         break;

      case "swim_meets":
         swim_menu('Swim Meets');
         break;

      case "coaches":
         swim_menu("Coaches");
         break;

      case "board_members":
         swim_menu("Board Members");
         break;
}

?>




_________________
The path of the righteous man is beset on all sides by the inequities of the selfish and the tyranny of evil men. Blessed is he, who in the name of charity and good will, shepherds the weak through the valley of darkness, for he is truly his brother's keeper and the finder of lost children. And I will strike down upon thee with great vengeance and furious anger those who would attempt to poison and destroy my brothers. And you will know my name is the Lord when I lay my vengeance upon thee. Ezekiel 25:17
Back to top Reply with quote
Display posts from previous:      
Add To: Del.icio.us  Digg  Google  Spurl  Blink  Furl  Y! MyWeb  
<< View previous topic View next topic >>
Post new topicReply to topic

Jump to 
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You cannot download files in this forum