buffer = ""; while (!feof($handle)) { $this->buffer .= fgets($handle,16384); } fclose($handle); $config = new Configuration(); $this->buffer = str_replace("$" . "(scriptsUrl)", $config->scriptsUrl, $this->buffer); $this->buffer = str_replace("$" . "(copyRight)", $config->copyRight, $this->buffer); $this->buffer = str_replace("$" . "(publisherEmail)", $config->publisherEmail, $this->buffer); $this->buffer = str_replace("$" . "(creatorEmail)", $config->creatorEmail, $this->buffer); $articlesTable->SetFilter(); $wcCategory = 0; if (isset($SUBMIT_FORM_VARS["wcCategory"])){ $wcCategory = $SUBMIT_FORM_VARS["wcCategory"]; } $wcHeadlines = 5; if (isset($SUBMIT_FORM_VARS["wcHeadlines"])){ $wcHeadlines = $SUBMIT_FORM_VARS["wcHeadlines"]; } $name = ""; $row = $categoriesTable->selectById($wcCategory); if ($row != null){ $id = $row->id; $name = $row->category_name; $itemsCount = $articlesTable->getRowsCount($row->id); if ($row->parent_cat != 0){ $rowOne = $categoriesTable->selectById($row->parent_cat); $name = $rowOne->category_name . " --> " . $name; } } else { $name = $config->mainTitle; } $this->buffer = str_replace("$" . "(categoryName)", $name, $this->buffer); $rows = $articlesTable->selectByCategoryId($wcHeadlines,$wcCategory); for ($i=0; $i<16; $i++){ if (isset($rows[$i])){ $item = new RssItem($rows[$i]->id); $item->title = $rows[$i]->title; $item->image = $rows[$i]->image; $item->description = short_descipt($rows[$i]->body); $this->buffer = str_replace("$" . "(item" . $i . "Url)", "scriptsUrl . "article_view.php?articleId=" . $rows[$i]->id . "\" />", $this->buffer); $this->buffer = str_replace("$" . "(item" . $i . ")", $item->toXml(), $this->buffer); } else{ $this->buffer = str_replace("$" . "(item" . $i . "Url)","",$this->buffer); $this->buffer = str_replace("$" . "(item" . $i . ")","",$this->buffer); } } echo $this->buffer; ?>