Greetings. On Tuesday 24 April 2007 09:22, Tijnema ! wrote: > > Right now, if the designer of the site wants to make a call to an > > external CSS style sheet within layout.php, the designer has to write in > > the whole path, relative to the index.php file. For example: > > <style type="text/css"> > > @import "/layout/styleOne/style.css"; > > </style> > > > > But I'd like to make it so that the designer doesn't need to ever think > > about paths, and can state the path to the CSS file relative to > > layout.php, and not relative to index.php. Like so: > > <style type="text/css"> > > @import "style.css"; > > </style> > > > > What happens is that index.php includes a file called include.php. That > > file in turn includes all the PHP scripts on the site. That file > > includes another file called Page.php which has a way of including > > layout.php depending on what style the page needs. For example, styleOne > > or styleTwo. > > > > That's a long linear string of includes, but bottom line is, if I'm > > correct, that the index.php ultimately includes layout.php, and > > layout.php therefor acts as if it were in the same directory as > > index.php. > > > > I hope I have described the situation adequately. > > > > My question is, as implied above: > > > > Can I somehow manipulate any of the PHP scripts involved so that the > > HTML within layout.php will look first in it's own directory for > > inclusion of files, such as CSS and javascript and anything else? > > > > Thank you for your time and assistance. > > Dave M G > > Ubuntu 7.04 Feisty Fawn > > Kernel 2.6.20-15-generic > > Pentium D Dual Core Processor function getCss($styleName) { $strReturn = "<style type='text/css'>@import '/layout/"._MY_LAYOUT_DIR_."/".styleName."';</style> return $strReturn; } layout.php <?php define("_MY_LAYOUT_DIR_","styleOne"); // when css file need use getCss('style.css') ?> And if you ask me for options. Kick designers until the they get learn someting about directory.... This kind of "auto magic" operations bloats scripts, increases CPU costs and increases security threads (because you assume lots of things and because of murph law your assumptations have to false) Also you cannot satisfy designers until generate some kind of mind reader device/software to automaticly convert their dreams into perfect html/php code. Even you invent that thing they will still complaing about no body understand their ability of art. So kick them hard as possible... Regards Sancar -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php