|
Posted by ScareCrowe on 07/09/05 01:22
I am having an issue with a class I am writing that simply grabs a remote
file and outputs a table depending on what info is in file. The remote file
is simply a text file list of names, one per line, which I get using file().
Everything seems to work fine except the variables aren't getting returned
correctly. I've copied the code below (I really stripped it down and
converted the file() to a static array for the constructor, to make it
easier to cut-n-paste for you all)
The vars siteinfo, permsg & feedid are NULL when the script runs. I've been
messing with it for some time now and I'm thinking it's right in front of me
and I'm just not seeing it.
<?
class display_cams{
var $feedid;
var $siteinfo;
var $permsg;
var $camcell;
var $odds = array(0,2,4,6);
var $thearray;
function display_cams(){
$this->thearray =
array("Bonnielass","BlahBlah","DumbBlonde","HoochieMama");
}//END func display_cams
//
function make_table(){
$this->camcell = "<table align=\"center\" cellpadding=\"0\"
cellspacing=\"4\">\n";
for($e=0;$e<count($this->thearray);$e++){
switch($this->models[$e]){
case "Bonnielass":
$this->feedid = 1;
$this->siteinfo = "The Bonnie Lass Site!";
$this->permsg = "Hi I'm Bonnie Lass";
break;
case "HoochieMama":
$this->feedid = 2;
$this->siteinfo = "The Hoochie Mama Site!";
$this->permsg = "Hi I'm Hoochie Mama";
break;
case "DumbBlonde":
$this->feedid = 3;
$this->siteinfo = "The Dumb Blonde Site";
$this->permsg = "Hi I'm A Dumb Blonde";
break;
case "BlahBlah":
$this->feedid = 4;
$this->siteinfo = "The Blah Blah Site";
$this->permsg = "Hi I'm Blah Blah";
break;
}//END switch
if(in_array($e, $this->odds)){//if loop is odd it is first cell in row
$this->camcell .= "\t<tr>\n";
$this->camcell .= "\t\t<td width=\"320\" align=\"center\"
style=\"border:1px solid
black;height:240px;width:320px;\">".$this->permsg."<br>";
$this->camcell .= $this->feedid."<br>".$this->siteinfo."</td>\n";
}else{//if loop is even it is last cell in row
$this->camcell .= "\t\t<td width=\"320\" align=\"center\"
style=\"border:1px solid
black;height:240px;width:320px;\">".$this->permsg."<br>";
$this->camcell .= $this->feedid."<br>".$this->siteinfo."</td>\n";
$this->camcell .= "\t</tr>\n";
}
}
$this->camcell .= "</table>\n";
echo $this->camcell;
}//END func make_table
}//End class
$cams = new display_cams();
$cams->make_table();
?>
Hopefully someone can tell me what it is I am overlooking/doing wrong!
Thanks Much,
--ScareCrowe
[Back to original message]
|