ap_ Posted April 18, 2008 Share Posted April 18, 2008 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? Quote Link to comment https://forums.phpfreaks.com/topic/101709-using-a-configphp-with-a-class/ Share on other sites More sharing options...
ap_ Posted April 18, 2008 Author Share Posted April 18, 2008 i didn't notice the chid boards! Quote Link to comment https://forums.phpfreaks.com/topic/101709-using-a-configphp-with-a-class/#findComment-520538 Share on other sites More sharing options...
clearstatcache Posted May 8, 2008 Share Posted May 8, 2008 use function define in defining your variables in your config.php for you to be able to get the values defined in your config.php. http://www.php.net/manual/en/function.define.php Quote Link to comment https://forums.phpfreaks.com/topic/101709-using-a-configphp-with-a-class/#findComment-535734 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.