class SiteMap { var $filename; var $root; var $fileurl; var $fd = NULL; function SiteMap($root,$fname,$mode=0) { $this->fileurl = $fname; $this->root = $root; $this->filename = $root . "/" . $fname; } function start(){ $this->fd = fopen($this->filename,'w+'); $string = ' '; fwrite($this->fd,$string); //fprintf($this->fd,$string); } function end() { $string="\n"; fwrite($this->fd,$string); //fprintf($this->fd,$string); fclose($this->fd); } function addUrl($loc,$pri='0.4',$freq='weekly',$time=NULL) { if($time == NULL) $time=time(); $lastmod=date('Y-m-d',$time); $string="\n$loc\n"; $string.="$lastmod\n"; $string.="$freq\n"; $string.="$pri\n"; $string.="\n"; fwrite($this->fd,$string); } } class SiteMapIdx{ var $root; var $fname; var $filename; var $fd = NULL; function SiteMapIdx($root,$fname){ $this->root = $root; $this->fname = $fname; $this->filename = $root . "/" . $fname; } function start(){ $this->fd = fopen($this->filename,'w+'); $string = ' '; fwrite($this->fd,$string); } function end() { $string = "\n"; fwrite($this->fd,$string); fclose($this->fd); $this->fd = null; } function addUrl($loc,$time=NULL) { if($time == NULL) $time=time(); $lastmod=date('Y-m-d',$time); $string="\n$loc\n"; $string.="$lastmod\n"; $string.="\n"; fwrite($this->fd,$string); } }