本文整理汇总了PHP中RSS::to_output方法的典型用法代码示例。如果您正苦于以下问题:PHP RSS::to_output方法的具体用法?PHP RSS::to_output怎么用?PHP RSS::to_output使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类RSS
的用法示例。
在下文中一共展示了RSS::to_output方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: execute
public function execute()
{
$this->output->description = "News";
$this->output->keywords = "news";
$this->output->title = "News";
$this->output->add_alternate("News", "application/rss+xml", "/news.xml");
if ($this->page->type == "xml") {
/* RSS feed
*/
$rss = new RSS($this->output);
if ($rss->fetch_from_cache("news_rss") == false) {
$rss->title = $this->settings->head_title . " news";
$rss->description = $this->settings->head_description;
if (($news = $this->model->get_news(0, $this->settings->news_rss_page_size)) != false) {
foreach ($news as $item) {
$link = "/news/" . $item["id"];
$rss->add_item($item["title"], $item["content"], $link, $item["timestamp"]);
}
}
$rss->to_output();
}
} else {
if (valid_input($this->page->pathinfo[1], VALIDATE_NUMBERS, VALIDATE_NONEMPTY)) {
/* News item
*/
if (($item = $this->model->get_news_item($this->page->pathinfo[1])) == false) {
$this->output->add_tag("result", "Unknown news item");
} else {
$this->output->title = $item["title"] . " - News";
$item["timestamp"] = date("j F Y, H:i", strtotime($item["timestamp"]));
$this->output->record($item, "news");
}
} else {
/* News overview
*/
if (($count = $this->model->count_news()) === false) {
$this->output->add_tag("result", "Database error");
return;
}
$paging = new pagination($this->output, "news", $this->settings->news_page_size, $count);
if (($news = $this->model->get_news($paging->offset, $paging->size)) === false) {
$this->output->add_tag("result", "Database error");
return;
}
foreach ($news as $item) {
$item["timestamp"] = date("j F Y, H:i", $item["timestamp"]);
$this->output->record($item, "news");
}
$paging->show_browse_links(7, 3);
}
}
}
示例2: execute
public function execute()
{
if ($this->page->type == "xml") {
/* RSS feed
*/
$rss = new RSS($this->output);
if ($rss->fetch_from_cache("rss_cache_id") == false) {
$rss->title = "RSS title";
$rss->description = "RSS description";
if (($items = $this->model->get_items()) != false) {
foreach ($items as $item) {
$rss->add_item($item["title"], $item["content"], $item["link"], $item["timestamp"]);
}
$rss->to_output();
}
}
} else {
/* Other page type
*/
}
}
示例3: execute
public function execute()
{
$months_of_year = config_array(MONTHS_OF_YEAR);
$this->output->title = "Weblog";
$this->output->description = "Weblog";
$this->output->keywords = "weblog";
$this->output->add_alternate("Weblog", "application/rss+xml", "/weblog.xml");
$this->url = array("url" => $this->page->page);
/* Sidebar
*/
$this->output->open_tag("sidebar");
/* Tags
*/
if (($tags = $this->model->get_all_tags()) != false) {
$this->output->open_tag("tags");
foreach ($tags as $tag) {
$this->output->add_tag("tag", $tag["tag"], array("id" => $tag["id"]));
}
$this->output->close_tag();
}
/* Years
*/
if (($years = $this->model->get_years()) != false) {
$this->output->open_tag("years");
foreach ($years as $year) {
$this->output->add_tag("year", $year["year"]);
}
$this->output->close_tag();
}
/* Periods
*/
if (($periods = $this->model->get_periods()) != false) {
$this->output->open_tag("periods");
foreach ($periods as $period) {
$link = array("link" => $period["year"] . "/" . $period["month"]);
$text = $months_of_year[$period["month"] - 1] . " " . $period["year"];
$this->output->add_tag("period", $text, $link);
}
$this->output->close_tag();
}
$this->output->close_tag();
if ($this->page->type == "xml") {
/* RSS feed
*/
$rss = new RSS($this->output);
if ($rss->fetch_from_cache("weblog_rss") == false) {
$rss->title = $this->settings->head_title . " weblog";
$rss->description = $this->settings->head_description;
if (($weblogs = $this->model->get_last_weblogs($this->settings->weblog_rss_page_size)) != false) {
foreach ($weblogs as $weblog) {
$link = "/weblog/" . $weblog["id"];
$rss->add_item($weblog["title"], $weblog["content"], $link, $weblog["timestamp"]);
}
}
$rss->to_output();
}
} else {
if ($_SERVER["REQUEST_METHOD"] == "POST") {
/* Comment submits
*/
if ($this->model->comment_oke($_POST) == false) {
$this->show_weblog($_POST["weblog_id"]);
$this->show_comment($_POST);
} else {
if ($this->model->add_comment($_POST) == false) {
$this->output->add_message("Error while adding comment.");
$this->show_weblog($_POST["weblog_id"]);
$this->show_comment($_POST);
} else {
$this->output->add_tag("result", "Comment has been added.", array("url" => $this->page->page . "/" . $_POST["weblog_id"]));
}
}
} else {
if ($this->page->pathinfo[1] == "tag" && valid_input($this->page->pathinfo[2], VALIDATE_NUMBERS, VALIDATE_NONEMPTY)) {
/* Tagged weblogs
*/
if (($tag = $this->model->get_tag($this->page->pathinfo[2])) == false) {
$this->output->add_tag("result", "Unknown tag", $this->url);
} else {
if (($weblogs = $this->model->get_tagged_weblogs($this->page->pathinfo[2])) === false) {
$this->output->add_tag("result", "Error fetching tags", $this->url);
} else {
$this->output->title = "Tag " . $tag . " - Weblog";
$this->output->open_tag("list", array("label" => "Weblogs with '" . $tag . "' tag"));
foreach ($weblogs as $weblog) {
$this->output->record($weblog, "weblog");
}
$this->output->close_tag();
}
}
} else {
if ($this->page->pathinfo[1] == "period" && valid_input($this->page->pathinfo[2], VALIDATE_NUMBERS, VALIDATE_NONEMPTY) && valid_input($this->page->pathinfo[3], VALIDATE_NUMBERS)) {
/* Weblogs of certain period
*/
if (($weblogs = $this->model->get_weblogs_of_period($this->page->pathinfo[2], $this->page->pathinfo[3])) === false) {
$this->output->add_tag("result", "Error fetching weblogs", $this->url);
} else {
if ($this->page->pathinfo[3] == null) {
$this->output->title = "Year " . $this->page->pathinfo[2] . " - Weblog";
} else {
//.........这里部分代码省略.........