diff options
author | Wushin <pasekei@gmail.com> | 2014-11-16 22:27:32 -0600 |
---|---|---|
committer | Wushin <pasekei@gmail.com> | 2014-11-16 22:27:32 -0600 |
commit | 6f37a79665408c3531842851fc6c3efabfe50a07 (patch) | |
tree | 6e8dc2a26e61bfe6ba61af731208fc07a8b2536e /extensions/tmwa/frontend/news.php | |
parent | e41baa4c3aeb5f2b05fb928c1bf13e6a9bb130a7 (diff) | |
parent | 294e5d28e70d1709520c3fbb78464edb557f638b (diff) | |
download | website-6f37a79665408c3531842851fc6c3efabfe50a07.tar.gz website-6f37a79665408c3531842851fc6c3efabfe50a07.tar.bz2 website-6f37a79665408c3531842851fc6c3efabfe50a07.tar.xz website-6f37a79665408c3531842851fc6c3efabfe50a07.zip |
Merge pull request #9 from wushin/www-to-wiki
Www to wiki
Diffstat (limited to 'extensions/tmwa/frontend/news.php')
-rw-r--r-- | extensions/tmwa/frontend/news.php | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/extensions/tmwa/frontend/news.php b/extensions/tmwa/frontend/news.php new file mode 100644 index 0000000..a214ea2 --- /dev/null +++ b/extensions/tmwa/frontend/news.php @@ -0,0 +1,41 @@ +<?php +class GameNewsPage extends SpecialPage { + + public function __construct() { + parent::__construct('GameNews'); + } + + public function execute( $par ) { + $request = $this->getRequest(); + $output = $this->getOutput(); + $this->setHeaders(); + + $wikitext = self::printNews(); + + $output->addWikiText( $wikitext ); + } + // Parses news.html + // displays feed + public function printNews($num='all') { + global $wgTMWNews; + $count = 0; + $content = ""; + $handle = @fopen($wgTMWNews, "r"); + if ($handle) { + while (($buffer = fgets($handle, 4096)) !== false) { + $content .= $buffer; + if (preg_match('/<\/div>/',$buffer)) { + $count++; + } + if ($count == $num && $num != 'all') { + $content .= '<div class="read-more"><a class="more" href="/news-feed.php">More News >></a></div>'; + break 1; + } + } + } + $output = $this->getOutput(); + $output->addHTML($content); + fclose($handle); + } +} +?> |