Re: Need help with bugs in my classes

From: Date: Wed, 10 Jan 2001 02:11:12 +0000
Subject: Re: Need help with bugs in my classes
References: 1  Groups: php.windows 
Request: Send a blank email to php-windows+get-4895@lists.php.net to get a copy of this message
I don't see $pdf as global var in your class??? Alain IThelp wrote: > > The following is a sample php file that is using the class section, class > box, that are in the file Print.inc > > I get numerous undefined variables errors I put one example of it in my > code. > > Here is the testing.php file that uses Print.inc > > Fatal error: Internal pdflib error: Couldn't write output (disk full?) in > Print.inc on line 0 > //I have over 15 Gigs left plus I have IUSER_COmputer Name full control > over all directories in my server > > <? //testing.php > include "Print.inc"; > > $fp = fopen("testing.pdf", "w"); > $pdf = pdf_open($fp); > pdf_begin_page($pdf, 576, 772); > pdf_add_outline($pdf, "Page 1"); > > pdf_set_font($pdf, "Times-Roman", 10, "host"); > pdf_set_value($pdf, "textrendering", 1); > > $usersection = new section( 576, 4, 36, 40); > > $usersection->addabox("testing", "nothing", 0); > > if(($usersection->output(650, $pdf))==1){ > echo("It seems to work"); > echo("<a href=\"testing.pdf\" target=\"_blank\">PDf > test</a>"); > > } > > ?> > > The following file is Print.inc > > <? > #Print.inc > > class section{ > > var $columns; //number of columns //most cases need an even > number title :: info > var $pagewidth; //width in pixels portrait is 576 w x 772 l > landscape is 772 w x 576 l > var $margin; //size of margins > var $columnheight; > var $arrayofboxes=array(); //array of boxes to be displayed in this > section > var $zarrayofboxes; //what index is arrayofboxesat > var $abnormalboxesarray=array();//array of boxes that are special in > some way > var $zabnormalboxesarray; //index for above > var $picboxesarray=array(); //array of boxes with pics in them > var $zpicboxesarray; //index for above > var $sectionheight; > var $standardboxheight; > > //pass in the page width > function section($widthin, $columnsin, $marginsin, $boxheight){ > $this->$columns=$columnsin; > ************************************I get an Warning: Undefined variable: > columns in Print.inc on line 22 > > $this->$pagewidth=$widthin; > $this->$margin=$marginsin; > $this->$arrayofboxes; > $this->$zarrayofboxes=0; > $this->$abnormalboxesarray; > $this->$zabnormalboxesarray=0; > $this->$picboxesarray; > $this->$zpicboxesarray=0; > $this->$standardboxheight=$boxheight; > > } > > function addabox($title, $info, $whatisthis){ > if($whatisthis==1){ > $userbox = new box($title, $info, $whatisthis); > $this->$arrayofboxes[$zarrayofboxes]=$userbox; > $this->$zarrayofboxes++; > return 1; > } > else if($whatisthis==0){ > $user2box = new box($title, $info, $whatisthis); > > $this->$abnormalboxesarray[$zabnormalboxesarray]=$user2box; > $this->$zabnormalboxesarray++; > return 1; > } > else if($whatisthis==2){ > $user3box = new box($title, $info, $whatisthis); > $this->$picboxesarray[$zpicboxesarray]=$user3box; > $this->$zpicboxesarray++; > return 1; > } > else { > return 0; > } > } > > function output($top, $pdf){ > > $totalmargin = $this->$margin * 2;************************ > Fatal error: Unsupported operand types in Print.inc on line 61 > //how can a simple multiply command > not be supported > > $realwidth= $pagewidth - $totalmargin; > $columnwidth= $realwidth/$this->$columns; > > $y=$top-($this->$standardboxheight); > > $tempbox=$this->$arrayofboxes[0]; > > pdf_show_boxed($pdf, $tempbox->getthetitle(), $margin, $y, > $columnwidth, $this->$standardboxheight, "left"); > > return 1; > > } > > } > > class box{ > > var $title; > var $info; > var $standardornot; //1=standard 0=notstandardtext 2=pic > > function box($titlein, $infoin, $whatisthis){ > $this->$title=$titlein; > $this->$info=$infoin; > $this->$standardornot=$whatisthis; > } > > function getthetitle(){ > return $this->$title; > } > > function gettheinfo(){ > return $this->$info; > } > > function getstandardornot(){ > return $this->$standardornot; > } > > } > > The help is appreciated thanks > > Ryan > > -- > PHP Windows Mailing List (http://www.php.net/) > To unsubscribe, e-mail: php-windows-unsubscribe@lists.php.net > For additional commands, e-mail: php-windows-help@lists.php.net > To contact the list administrators, e-mail: php-list-admin@lists.php.net

« previous php.windows (#4895) next »