Ravens PHP Scripts: Forums
 

 

View next topic
View previous topic
Post new topic   Reply to topic    Ravens PHP Scripts And Web Hosting Forum Index -> Modules
Author Message
Donovan
Client


Joined: Oct 07, 2003
Posts: 735
Location: Ohio

PostPosted: Sat Feb 28, 2009 8:28 pm Reply with quote

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.
Only registered users can see links on this board! Get registered or login!
 
View user's profile Send private message Visit poster's website ICQ Number
duck
Involved
Involved


Joined: Jul 03, 2006
Posts: 273

PostPosted: Sat Feb 28, 2009 9:13 pm Reply with quote

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?
 
View user's profile Send private message
Donovan
PostPosted: Sat Feb 28, 2009 11:17 pm Reply with quote

Different page. I am moving everything under a single index.php and making functions.
 
duck
PostPosted: Sun Mar 01, 2009 12:53 am Reply with quote

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
PostPosted: Sun Mar 01, 2009 8:46 am Reply with quote

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: 17077

PostPosted: Sun Mar 01, 2009 11:14 am Reply with quote

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&trade; - Distributed by RavenPhpScripts</b></a>

RaveNNuke(tm) is no longer PHPNUKE,
 
View user's profile Send private message
Donovan
PostPosted: Sun Mar 01, 2009 11:35 am Reply with quote

"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
PostPosted: Sun Mar 01, 2009 12:44 pm Reply with quote

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
PostPosted: Sun Mar 01, 2009 1:23 pm Reply with quote

How about this?

Image
 
Raven
PostPosted: Sun Mar 01, 2009 4:05 pm Reply with quote

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
PostPosted: Sun Mar 01, 2009 6:38 pm Reply with quote

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.
 
Display posts from previous:       
Post new topic   Reply to topic    Ravens PHP Scripts And Web Hosting Forum Index -> Modules

View next topic
View previous topic
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 can attach files in this forum
You can download files in this forum


Powered by phpBB © 2001-2007 phpBB Group
All times are GMT - 6 Hours
 
Forums ©