Jump to content

php class error


ap_

Recommended Posts

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

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

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.