Search the Community
Showing results for tags 'define'.
-
Hello, I was wondering if it's good practice and if it's safe to define constants that use magic constants to access various directories in a project, even directories outside the webroot. I've found many documentations that discuss how useful are constants when debugging, but what's the usual usage apart from that? For example, is it good practice to write: <?php define('WEBROOT', __DIR__); define('ROOT', dirname(WEBROOT)); define('CORE', ROOT.'/core/'); define('CONFIG', ROOT.'/config/'); define('ADMIN', ROOT.'/admin/'); include CORE.'includes/header.inc.php';
-
hello all from w3s again... i have seemed the PHP word ''Define''. now my questio is. if i have 2 files in my root, and 3 files in a folder called include, and one of those inside include folder is called main_design.php. and called by 2 functions like so inside all the other files inside root...: function stdhead($title = "",$css_file = ""){$stdhead_start = "<!DOCTYPE html PUBLIC '-//W3C//DTD XHTML 1.0 Transitional//EN' 'http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd'><html xmlns='http://www.w3.org/1999/xhtml'><head><meta http-equiv='Content-Type' content='text/html'; charset=iso-8859-1' /><link rel='stylesheet' type='text/css' href='styles/".$css_file.".css'/><link rel='shortcut icon' href='fav_icon.ico' /><title>".$title."</title></head><body><table class='banner_table' align='center' cellpadding='0'><tr><td><a href='index.php'><img src='styles/images/banners/banner.png' width='1000' height='140' alt='SS_2012' /></a></td></tr></table> <table class='menu_table' border='0' align='center'><tr><td class='navigation'><a href='index.php'>HOME</a></td><td class='navigation'><a href='browse.php'>TORRENTS</a></td><td class='navigation'><a href='index.php'>REQUESTS</a></td><td class='navigation'><a href='index.php'>BECOME UPLOADER</a></td><td class='navigation'><a href='index.php'>CHAT</a></td><td class='navigation'><a href='index.php'>FORUM</a></td><td class='navigation'><a href='index.php'>GUIDES</a></td><td class='navigation'><a href='index.php'>BONUS</a></td><td class='navigation'><a href='index.php'>RULES</a></td><td class='navigation'><a href='index.php'>FAQ</a></td><td class='navigation'><a href='index.php'>LINKS</a></td><td class='navigation'><a href='index.php'>SUPPORT</a></td></tr></table> <table class='main_table' align='center'><tr><td>";return $stdhead_start;}//stdhead ends... function stdfooter(){$stdfoot_start ="</td></tr></table> <table class='foot_table' align='center'> <tr> <td>Speed-Scene © 2012 -> Revision 01</td> </tr> </table> </body> </html>";return $stdfoot_start;}//stdfooter ends... and root files ect; <?phprequire_once("include/bittorrent.php");echo stdhead("Home","1");?>This is the Index Page!...<?phpecho stdfooter();?> now my question is, that if i have an another file inside include called config.php. and wish to make a define inside there... and after that, call it on one of the root files, so it would go inside the include folder, and then i just need to write the name of the file i need to have ect... how do i do this?... thanks in advance!