Page 1 of 1
File exists function for anchor points?
Posted: Mon Jul 06, 2009 10:46 am
by anivad
Is there something similar to the file_exists function that can be used to apply to anchor points?
Such that the code can check if for example 'page.htm#anchor' exists, rather than just 'page.htm' on its own.
Thanks!
Re: File exists function for anchor points?
Posted: Mon Jul 06, 2009 10:54 am
by genconv
Is there something similar to the file_exists function that can be used to apply to anchor points?
No, there isn't. (Of course you can create your own function or a class for that)
If your site is on-line, you can use for example the function file_get_contents to check if URL exists:
Code: Select all
if(file_get_contents('http://www.yoursite.com/page.htm#anchor'){
echo 'URL exists';
} else {
echo 'URL does not exists';
}
Re: File exists function for anchor points?
Posted: Mon Jul 06, 2009 11:12 am
by anivad
That works; thanks!
Though there seems to be an anchor bug in Firefox.