This is a discussion on Dynamic Image SRC within the PHP Language forums, part of the PHP Programming Forums category; "Derek Fountain" <nospam@example.com> escreveu na mensagem news:4210739c$0$30059$5a62ac22@per-qv1-newsreader-...
|
|||||||
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
|
|||
|
"Derek Fountain" <nospam@example.com> escreveu na mensagem
news:4210739c$0$30059$5a62ac22@per-qv1-newsreader-01.iinet.net.au... >> This works fine with the front page, but in the index page for >> http://localhost/gongfamily/daevid/ >> >> the images are broken, because the links are relative. I could >> make the links absolute, but then I couldn't use my testing >> server. There might be an Apache solution to this, such as >> setting up some sort of alias or virtual root, but that stuff is >> beyond me. > > My current project lives in a directory called 'dp', and my test machine > is > called 'monkey' (or 'localhost'). I use this function to set a couple of > path variables: > > function setPaths( &$filePath, &$httpPath ) > { > if( (strcmp( $_SERVER['SERVER_NAME'], "monkey" ) == 0) || > (strcmp( $_SERVER['SERVER_NAME'], "localhost" ) == 0) ) { > $filePath = "/home/derek/public_html/dp/"; > $httpPath = "/~derek/dp/"; > } else { > $filePath = "/home/derek/html/www.dp.com/public_html/"; > $httpPath = "/"; > } > } > > This gets called at the top of each page as part of the standard > boilerplate > code I always use. I then access images and the like with $httpPath and > text and config files with $filePath. > > -- > The email address used to post is a spam pit. Contact me at > http://www.derekfountain.org : <a > href="http://www.derekfountain.org/">Derek Fountain</a> I used something similar and it's pretty simple :) Regards, RootShell |