path - php: setting root directory for project? -
i'm having following url test project on local server:
http://localhost/projects/test/
now i'd have have possibilty of using root directory eg. includes/images - <img src='/img/test.jpg'>
- way save me lot of time simple put online without path modifications/flag.
any ideas how work?
thanks
i guess not php related question, more on html. may on <base>
tag. instead of saying:
<img src='/img/test.jpg'>
go , make:
<head><base href="http://localhost/projects/test/" /> ... </head> <body> <img src="img/test.jpg" /> </body>
which in fact point to: http://localhost/projects/test/img/test.jpg
and php scripts use set_include_path() function
<?php $path = '/usr/lib/pear'; set_include_path(get_include_path() . path_separator . $path); ?>
Comments
Post a Comment