mellis95 Posted May 4, 2009 Share Posted May 4, 2009 I am having trouble figuring out how to reference a variable within a hyperlink within a class.... (I think I worded that right) globals.inc: <? //------------------- //Configure this section $cname="Test Clinic, Inc."; //company name $s="pto"; //server name ?> //------------------- phpddm.inc.php(partial): $PHPDDM_menu[0] = new phpddm_menu('Documentation', 'DOCUMENTATION', 150, '#', '_parent'); $PHPDDM_submenu[0][0] = new phpddm_submenu('PT Evaluation', 'http://'$SERVERNAME VARIABLE HERE'/forms/pt/eval.php', '_parent'); I am trying to use the server name variable from globals.inc as the variable part of the hyperlink (second line of posted code from phpddm.inc.php). I am still fairly new to PHP, so please let me know if I am going about this completely wrong. I know that the variable works, because I can echo it in other places. I just can't figure out how to reference it in this scenario. Below are the relevant portions of the phpddm class class phpddm_menu { function phpddm_menu($title, $vtitle, $width, $url, $target) { $this->TITLE = $title; $this->VTITLE = $vtitle; $this->WIDTH = $width; $this->URL = $url; $this->TARGET = $target; } } class phpddm_submenu { function phpddm_submenu($title, $url, $target) { $this->TITLE = $title; $this->URL = $url; $this->TARGET = $target; } } Thank you in advance. Matt Link to comment https://forums.phpfreaks.com/topic/156849-solved-how-do-i-properly-code-this-line/ Share on other sites More sharing options...
Ken2k7 Posted May 4, 2009 Share Posted May 4, 2009 Just include globals.inc into your PHP and just put ".$s." The thing between the quotes. Link to comment https://forums.phpfreaks.com/topic/156849-solved-how-do-i-properly-code-this-line/#findComment-826232 Share on other sites More sharing options...
mellis95 Posted May 5, 2009 Author Share Posted May 5, 2009 Thank you! I had included globals.inc, but I couldn't figure out that it should be .$s. (the periods were getting me) Thanks again. Problem solved Link to comment https://forums.phpfreaks.com/topic/156849-solved-how-do-i-properly-code-this-line/#findComment-826352 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.