Пример #1
0
 private function parseItem()
 {
     $item = new NewsItem();
     while ($this->reader->read()) {
         if ($this->reader->nodeType == XMLReader::END_ELEMENT && $this->reader->name == 'item') {
             if ($item->getTitle() == $item->desc) {
                 $item->desc = '';
             }
             $this->items[] = $item;
             return;
         }
         if ($this->reader->nodeType != XMLReader::ELEMENT) {
             continue;
         }
         $key = strtolower($this->reader->name);
         switch ($key) {
             case 'title':
                 $item->setTitle(trim($this->reader->readValue()));
                 break;
             case 'description':
                 $item->desc = trim($this->reader->readValue());
                 break;
             case 'content:encoded':
                 // XXX non standard tag
                 $item->body = trim($this->reader->readValue());
                 break;
             case 'author':
             case 'dc:creator':
                 // XXX non standard tag
                 $item->author = $this->reader->readValue();
                 break;
             case 'link':
                 $url = $this->reader->readValue();
                 $item->setUrl(trim(self::FixUrl($url)));
                 break;
             case 'pubdate':
             case 'dc:date':
                 // XXX non standard tag, <dc:date>2012-02-01 05:50:00</dc:date>
                 $item->setTimestamp($this->reader->readValue());
                 break;
             case 'guid':
                 $item->guid = $this->reader->readValue();
                 break;
             case 'category':
                 $item->category = $this->reader->readValue();
                 break;
             default:
                 if (in_array($key, $this->ext_tags)) {
                     $this->pluginParseTag($key, $item);
                 } else {
                     // echo 'unknown item entry ' .$this->reader->name.ln();
                 }
                 break;
         }
     }
     $this->items[] = $item;
 }
Пример #2
0
			</div>
			
			<p><i>
				This is my page about me. Now, you may have noticed that there is no color or graphics on this page. 
				The theme is inspired by the clean theme from <a href="http://mnmlist.com/">mnmlist.com</a> written by Leo Babauta.
				The purpose is that I want people to read what I'm writing, not looking at the pretty colors or the fancy pictures.  
			</i></p>
			
			<h2>News</h2>
		
			<?php 
foreach ($newsItems as $newsItem) {
    ?>
 
			<h3><?php 
    echo $newsItem->getTitle();
    ?>
 - <?php 
    echo DateFormat::toNewsDate($newsItem->getCreatedTimestamp());
    ?>
</h3>
			<p>
				<?php 
    echo $newsItem->getContent();
    ?>
			</p>
			<?php 
}
?>
		</div>
	</body>
Пример #3
0
        print "      <div class=\"col-md-3\">\n";
        print "        " . $article->getPublish() . "\n";
        print "      </div>\n";
        print "      <div class=\"col-md-3 hidden-xs\">\n";
        if ($article->getEdited() !== false) {
            print "        <small>Edited by: " . $article->getEdited() . "</small>\n";
        }
        print "      </div>\n";
        print "      <div class=\"col-md-3 hidden-xs\">\n";
        print "        " . $article->getEdit() . "\n";
        print "      </div>\n";
        print "    </div>\n";
    }
    print "    <div class=\"row\">\n";
    print "      <div class=\"col-md-12\">\n";
    print "        <h3>" . $article->getTitle() . "</h3>\n";
    print "        " . $article->getContent() . "\n";
    print "      </div>\n";
    print "    </div>\n";
} else {
    print '      <h2>No article selected to preview!</h2>' . PHP_EOL;
}
print "  </div>\n";
print "</div>\n";
?>
<div class="row pane">
  <div class="col-xs-12">
    <form class="form-horizontal" action="<?php 
print $_SERVER['REQUEST_URI'];
?>
" method="get">