2009-05-15 5 views
-2

RSS를 작성하는 함수를 호출하기에 적합한 곳입니까? 사이트의 reddit 유형에 대한.RSS 빌딩 기능을 호출하기에 적합한 곳입니까?

function save() { 
    /* 
      Here we do either a create or 
      update operation depending 
      on the value of the id field. 
      Zero means create, non-zero 
      update 
    */ 

     if(!get_magic_quotes_gpc()) 
     { 
      $this->title = addslashes($this->title); 
      $this->description = addslashes($this->description); 
     } 

     try 
     { 
      $db = parent::getConnection(); 
      if($this->id == 0) 
      { 
       $query = 'insert into articles (modified, username, url, title, description, points)'; 
       $query .= " values ('$this->getModified()', '$this->username', '$this->url', '$this->title', '$this->description', $this->points)"; 
       createRSS(); //**** rss function**** 
      } 
      else if($this->id != 0) 
      { 
       $query = "update articles set modified = NOW()".", username = '$this->username', url = '$this->url', title = '".$this->title."', description = '".$this->description."', points = $this->points, ranking = $this->ranking where id = $this->id"; 
      } 

      $lastid = parent::execSql2($query); 

      if($this->id == 0) 
       $this->id = $lastid; 

     } 
     catch(Exception $e){ 
      throw $e; 
     } 
    } 

덕분에 많은

+3

이 질문은 현재 답변이 없습니다. 게시 한 코드는 앱의 작동 방식을 알려주지 않습니다. – ceejayoz

답변

1
아마

없습니다. RSS 피드를 업데이트하지 않고 기사 개체를 저장하려는 경우가있을 수 있습니다. 당신은 어떤 시점에서 기사의 아카이브를 가져올 수 있습니다. 따라서 save()를 호출하는 것은 무엇이든 즉시 createRSS()를 호출해야합니다.

function createArticle($title, ...) { 
    $article->setTitle($title); 
    ... 
    $article->save(); 
    createRSS(); 
} 
관련 문제