You are here: Re: Detection of missing links « All PHP « IT news, forums, messages
Re: Detection of missing links

Posted by Senator Jay Billington Bulworth on 10/10/46 11:22

"PHPeter" <me@privacy.net> wrote in
news:42e752e5$0$24474$ed2619ec@ptn-nntp-reader03.plus.net:

> I wonder if someone can help me?
>
> I have a table of records - in fact it is an index. Each record has a
> 'More' hyperlink which is supposed to take you to a more detailed
> information page - one for each entry.
>
> The 'More' hyperlink is displayed on the fly as the table is being
> displayed. It is going to take me some time to complete each detailed
> information page so I would like to have the 'More' hyperlink
> displayed only when a valid page has been written.
>
> Is there a way of detecting a missing URL to the detailed page so I
> can suppress the corresponding 'More' link?. This would avoid the
> 'Page Not Found' warning.

<?php

$test = join('', file('http://your.server.com/more123.html'));
if(eregi('not found', $test)){ //Test against a string in your 404 page
echo 'No details currently available.';
}
else{
echo "<a href='/more123.html'>More Details</a>";
}
?>

Just edit the URL that $test is looking up based upon wherever the
details link would point for that particular record. Make sure the eregi
() call is testing against a string that appears in your ErrorDocument
404.

hth


--

Bulworth : PHP/MySQL/Unix | Email : str_rot13('f@fung.arg');
--------------------------|---------------------------------
<http://www.phplabs.com/> | PHP scripts, webmaster resources

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация