Author |
Message |
Donovan
Client

Joined: Oct 07, 2003
Posts: 735
Location: Ohio
|
Posted:
Sat Feb 28, 2009 8:28 pm |
|
I'm working on a module for my kids swim team.
I don't understand what is happening with the case statement. It should default to the information function but it shows roster instead.
It starts out like this.
Code:if ( !defined('MODULE_FILE') ){die("You can't access this file directly...");}
require_once('mainfile.php');
$module_name = basename(dirname(__FILE__));
define('INDEX_FILE', true);
//if (!isset($view)) $view = '';
switch ($view) {
case 'roster':
roster();
break;
case 'teamrecords':
teamrecords();
break;
case 'poolrecords':
poolrecords();
break;
case 'swimmeets':
swimmeets();
break;
case 'coaches':
coaches();
break;
case 'boardmembers':
boardmembers();
break;
default:
information();
break;
}
/**
* ONLY functions beyond this point
*/
|
Then I have a bunch of functions.
Code://=================================================
// Information
//=================================================
function information() {
global $prefix, $db, $bgcolor2, $bgcolor3;
include("header.php");
//swimmenu();
OpenTable();
echo"<table border=\"1\" width=\"100%\" cellpadding=\"3\">";
echo"<tr>"
."<td>Information Under Construction</td>"
."</tr>"
."</table>";
CloseTable();
include("footer.php");
}
//=================================================
// Roster
//=================================================
function roster() {
global $prefix, $db, $bgcolor2, $bgcolor3;
include("header.php");
//swimmenu();
echo"<table border=\"1\" width=\"100%\" cellpadding=\"3\">";
echo"<tr>"
."<td>Roster Under Construction</td>"
."</tr>"
."</table>";
include("footer.php");
}
//=================================================
// Team Records
//=================================================
function teamrecords() {
global $prefix, $db, $bgcolor2, $bgcolor3;
include("header.php");
//swimmenu();
echo"<table border=\"1\" width=\"100%\" cellpadding=\"3\">";
echo"<tr>"
."<td>Team Records Under Construction</td>"
."</tr>"
."</table>";
include("footer.php");
}
//=================================================
// Pool Records
//=================================================
function poolrecords() {
global $prefix, $db, $bgcolor2, $bgcolor3;
include("header.php");
//swimmenu();
echo"<table border=\"1\" width=\"100%\" cellpadding=\"3\">";
echo"<tr>"
."<td>Pool Records Under Construction</td>"
."</tr>"
."</table>";
include("footer.php");
}
//=================================================
// Swim meet
//=================================================
function swimmeets() {
global $prefix, $db, $bgcolor2, $bgcolor3;
include("header.php");
//swimmenu();
echo"<table border=\"1\" width=\"100%\" cellpadding=\"3\">";
echo"<tr>"
."<td>Swim Meets Under Construction</td>"
."</tr>"
."</table>";
include("footer.php");
}
//=================================================
// Coaches
//=================================================
function coaches() {
global $prefix, $db, $bgcolor2, $bgcolor3;
include("header.php");
//swimmenu();
echo"<table border=\"1\" width=\"100%\" cellpadding=\"3\">";
echo"<tr>"
."<td>Coaches Under Construction</td>"
."</tr>"
."</table>";
include("footer.php");
}
//=================================================
// Board Members
//=================================================
function boardmembers() {
global $prefix, $db, $bgcolor2, $bgcolor3;
include("header.php");
//swimmenu();
echo"<table border=\"1\" width=\"100%\" cellpadding=\"3\">";
echo"<tr>"
."<td>Board Members Under Construction</td>"
."</tr>"
."</table>";
include("footer.php");
}
|
This should be the first thing you see when you enter the Swim_Team module.
http://www.idlehourswimteam.org/modules.php?name=Swim_Team |
|
|
 |
 |
duck
Involved


Joined: Jul 03, 2006
Posts: 273
|
Posted:
Sat Feb 28, 2009 9:13 pm |
|
Sometimes I am a nubsauce and don't read the question properly for answering so if ya read my earlier answer disregard.
Anyway, I looked at your site and the link to SwimTeam says &file=roster.
Nothing about view but maybe you've changed that on purpose for some reason? |
|
|
|
 |
Donovan

|
Posted:
Sat Feb 28, 2009 11:17 pm |
|
Different page. I am moving everything under a single index.php and making functions. |
|
|
|
 |
duck

|
Posted:
Sun Mar 01, 2009 12:53 am |
|
I have no clue? The code you posted looks fine. You don't need a break statement if default is on the end but that shouldn't affect anything. Are you positive your not missing a variable in the file somewhere where you set $view to roster? |
|
|
|
 |
Donovan

|
Posted:
Sun Mar 01, 2009 8:46 am |
|
If I change the statement and move information to the top then the page displays information instead of the swimmenu.
It's not going through the switch statement.
Code:switch ($view) {
case 'information':
information();
break;
case 'roster':
roster();
break;
case 'teamrecords':
teamrecords();
break;
case 'poolrecords':
poolrecords();
break;
case 'swimmeets':
swimmeets();
break;
case 'coaches':
coaches();
break;
case 'boardmembers':
boardmembers();
break;
default:
swimmenu();
break;
}
|
I have this near the top and wonder if it is doing any good?
Code:
if (!isset($view)) $view = '';
|
|
|
|
|
 |
Raven
Site Admin/Owner

Joined: Aug 27, 2002
Posts: 17088
|
Posted:
Sun Mar 01, 2009 11:14 am |
|
If this is RavenNuke(tm) then you need to restore, at a minimum, the footer line that says <a href="http://www.ravenphpscripts.com/"><b>RavenNuke™ - Distributed by RavenPhpScripts</b></a>
RaveNNuke(tm) is no longer PHPNUKE, |
|
|
|
 |
Donovan

|
Posted:
Sun Mar 01, 2009 11:35 am |
|
"restore" I never took it off. Would this be in the themefooter()?
So if I use RavenNuke like I have been doing for years I have to edit my theme? |
|
|
|
 |
Raven

|
Posted:
Sun Mar 01, 2009 12:44 pm |
|
You need to put back, at a minimum the one line.
Only registered users can see links on this board! Get registered or login! |
|
|
|
 |
Donovan

|
Posted:
Sun Mar 01, 2009 1:23 pm |
|
How about this?
 |
|
|
|
 |
Raven

|
Posted:
Sun Mar 01, 2009 4:05 pm |
|
Usually it's the theme writers who remove it for [as yet] unknown reasons.
the image is nice, if it doesn't disrupt your site. But would you do this in addition? Rankings are based on Links, not Images, at least to my knowledge. So the text link is really important.
Only registered users can see links on this board! Get registered or login!
Only registered users can see links on this board! Get registered or login!
Of course the image would be centered on the page and the test link centered under it. Please let me know your thoughts. You could make the image smaller if you wanted, like
Only registered users can see links on this board! Get registered or login!
Only registered users can see links on this board! Get registered or login! |
|
|
|
 |
duck

|
Posted:
Sun Mar 01, 2009 6:38 pm |
|
Once ya fix the link for Raven I can't hep wonder if that $view variable is being set globally somewhere. Try using a new variable name like $rview and see what happens. |
|
|
|
 |
|