ap_ Posted April 18, 2008 Share Posted April 18, 2008 i have this code <?php ob_start(); class build{ private $title; private $keywords; public function display(){ print("<html>\n"); print("<head>\n"); print("<title>$this->title \n"); print(" $this->keywords</title>\n"); print cssdisplay(); print("<head>\n"); print("<body>\n"); print maincontent(); print("</body>\n"); print("</html>"); } public function cssdisplay($margin,$back,$font,$linkcolor,$none){ print("<style type=text/css>\n"); print("body{\n"); print("margin-top: $margin;\n"); print("background: url('$back');\n"); print("font: $font;\n"); print("}\n"); print("a:link{color: $linkcolor;}\n"); print("a:active{color: $linkcolor;}\n"); print("a:visited{color: $linkcolor;}\n"); print("a:hover{color: $linkcolor; text-decoration: $none;}\n"); print("</style>"); } } ob_end_flush(); ?> and recieve this error when called to the index Fatal error: Call to undefined function cssdisplay() in C:\serverbin\apache\htdocs\under\bridge.class on line 16 little help? i have read a lot but still i need some practice! thanks by the way! Link to comment https://forums.phpfreaks.com/topic/101691-php-class-error/ Share on other sites More sharing options...
Daniel0 Posted April 18, 2008 Share Posted April 18, 2008 It has to be $this->cssdisplay() Link to comment https://forums.phpfreaks.com/topic/101691-php-class-error/#findComment-520251 Share on other sites More sharing options...
ap_ Posted April 18, 2008 Author Share Posted April 18, 2008 im having truoble giving the cssdisplay() variable values cause im trying to use a config.php file throught the index , any ideas? <?php ob_start(); class build{ private $title; private $keywords; private $margin; private $backg; private $font; private $linkcolor; private $none; public function display(){ print("<html>\n"); print("<head>\n"); print("<title>$this->title \n"); print(" $this->keywords</title>\n"); print $this->cssdisplay(); print("<head>\n"); print("<body>\n"); //print $this->maincontent(); print("</body>\n"); print("</html>"); } public function cssdisplay(){ print("<style type=text/css>\n"); print(" body{\n"); print(" margin-top: $this->margin;\n"); print(" background: url('$this->backg');\n"); print(" font: $this->font;\n"); print("}\n"); print("a:link{color: $this->linkcolor;}\n"); print("a:active{color: $this->linkcolor;}\n"); print("a:visited{color: $this->linkcolor;}\n"); print("a:hover{color: $this->linkcolor; text-decoration: $this->none;}\n"); print("</style>"); } } ob_end_flush(); ?> thanks by the way! Link to comment https://forums.phpfreaks.com/topic/101691-php-class-error/#findComment-520326 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.