Jump to content

Recommended Posts

im having troubles passing variables from config.php to index.php

 

index.php

<?php

require("config.php");
require("main.class");

$cn = new build;

print $cn->display();


?>

 

 

 

config.php

<?php

$margin = "30px";
$back = "media/black.bmp";

?>

 

 

 

main.class

<?php

ob_start();

class build{

var $title;
var $keywords;
var $margin;
var $backg;
var $font;
var $linkcolor;
var $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();

?>

 

a little help here?

 

Link to comment
https://forums.phpfreaks.com/topic/101709-using-a-configphp-with-a-class/
Share on other sites

  • 3 weeks later...
This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.