yahelarmster Posted July 6, 2012 Share Posted July 6, 2012 Hello there! Okay, i'm really new to php but i love it, right now i want to make a configure.php file that holds the directories for css, js, and links & stuff like in oscommerce: define ('DIR_STYLES' , 'styles/'); and lets say that i want to call the styles directory when i declare a stylesheet like so: <link rel="stylesheet" href="<?php howDoICallIt... ;?>" type="text/css" /> could you helpe me with this? Quote Link to comment Share on other sites More sharing options...
Psycho Posted July 7, 2012 Share Posted July 7, 2012 A constant is pretty much just like variable - just without the dollar sign. Just echo it out. But in your example you didn't provide the file name. <link rel="stylesheet" href="<?php echo DIR_STYLES . 'name_of_css_file.css'; ?>" type="text/css" /> or <link rel="stylesheet" href="<?php echo DIR_STYLES; ?>name_of_css_file.css" type="text/css" /> Quote Link to comment Share on other sites More sharing options...
yahelarmster Posted July 7, 2012 Author Share Posted July 7, 2012 oh yes yes, thanks, so, i'm using an index.php that holds the whole controller, and when someone clicks the submit button or click a <a href="?add" ... > the controller will handle it, then include a form. i want to have a configure.php file with images, js, css and stuff directories defined, so let's say that i want to do this: ... index.php excerpt: ... if (isset($_GET['addform'])) { buncha' code... include 'form.html.php'; exit(); } configure excerpt: define ('DIR_STYLES', 'styles/'); define ('DIR_IMAGES', 'images/'); etc... and then on the form.html.php call the style like: <link rel="stylesheet" href="<?php echo DIR_STYLES . 'main.css'; ?>" type="text/css" /> so, with all that info, do you think it will work??? Quote Link to comment 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.