public function Index() { $this->layout = 'homepage'; $content = Content::find_by_permalink("index"); $nextEvent = Event::next_event(); $news = array(); if ($nextEvent) { $permalink = mysql_real_escape_string($nextEvent->permalink); $newsTags = NewsTag::find_all("news.publish_at <= NOW() AND news.published AND tags.permalink = '{$permalink}'", "news.publish_at DESC", 3); foreach ($newsTags as $tag) { $tag->news->reload(); $news[] = $tag->news; } } $this->assign("news", $news); $this->assign("content", $content); $this->assign("next_event", $nextEvent); global $config; $this->assign("baseurl", $config['forums']['base_url']); $this->render("home/index.tpl"); }
public function news($reload = false) { if ($reload or !$this->news_cache) { $id = mysql_real_escape_string($this->id); $this->news_cache = NewsTag::find_all("news_tags.tag_id = '{$id}'"); } return $this->news_cache; }