View Single Post
Old 05-13-2012, 11:41 AM  
fris
Too lazy to set a custom title
 
fris's Avatar
 
Industry Role:
Join Date: Aug 2002
Posts: 55,427
Quote:
Originally Posted by roly View Post
yes that's the sort of thing.
links.txt

Code:
http://www.bing.com|very unpopular search engine
http://www.google.com|search engine
http://www.gfy.com|gfy forum
to show the links

Code:
<?

$show = 30;
$linkfile = dirname(__FILE__). "/links.txt";
$links = file($linkfile);
$result = array();
for ($i=0; (($i<$show) && ($i<count($links))); $i++) {
  $link = explode("|", $links[$i]);
  $result[] = '<a href="' . $link[0] . '">' . $link[1] . '</a><br/>';
  echo $result[$i];
}
	
?>
script to run in crontab once every 24 hours

Code:
<?

$linkfile = dirname(__FILE__). "/links.txt";
$tmp = file($linkfile);
$result = array();
$result[] = trim($tmp[(count($tmp)-1)]);
unset($tmp[(count($tmp)-1)]);

foreach ($tmp as $idx => $t) {
   $result[] = trim($t);
}

$s = implode("\n", $result);
$fp = fopen($linkfile, "w+");
fwrite($fp, $s);
fclose($fp);

?>
__________________
Since 1999: 69 Adult Industry awards for Best Hosting Company and professional excellence.


WP Stuff
fris is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote