File:  [mozdev] / aecreations / www / index.html
Revision 1.113: download - view: text, annotated - select for diffs - revision graph
Wed Feb 12 12:44:02 2014 UTC (3 years, 10 months ago) by ateng
Branches: MAIN
CVS tags: HEAD
Fixed redirect user message

<?php

function createBlogPostPreviewItem($title, $date, $postURL)
{
  echo "<div class=\"homepg-blog-preview\">\n";
  echo '  <p><span class="homepg-blog-post-date">' . $date . ' <img src="/img/index.png" class="index"> </span> <a href="' . $postURL . '">' . $title . "</a></p>\n</div>\n";
}


function createBlogPostPreview()
{
  $feedURL = 'http://aecreations.blogspot.com/feeds/posts/default?start-index=1&max-results=3';

  $xmlDoc = new DOMDocument();
  $rv = $xmlDoc->load($feedURL);
  if (! $rv) {
    echo "  <!-- Error loading feed URL for AE Creations Blog -->\n";
    return;
  }

  $entries = $xmlDoc->getElementsByTagName('entry');
  $maxPosts = $entries->length;

  $titles = array();
  $dates = array();
  $postURLs = array();
  
  for ($i = 0; $i < $maxPosts; $i++) {
    $children = $entries->item($i)->childNodes;

    foreach ($children as $child) {
      if ($child->nodeName == 'title') {
        $titles[$i] = $child->nodeValue;
      }

      if ($child->nodeName == 'published') {
        $dtz = timezone_open('America/Los_Angeles');
        $dt = date_create($dates[$i] = $child->nodeValue, $dtz);
        $dates[$i] = date_format($dt, "d-M-Y");
      }

      if ($child->nodeName == 'link') {
        if ($child->getAttribute('rel') == 'alternate') {
          $postURLs[$i] = $child->getAttribute('href');
        }
      }
    }
  }

  for ($i = 0; $i < count($titles); $i++) {
    createBlogPostPreviewItem($titles[$i], $dates[$i], $postURLs[$i]);
  }
}

?>


<div id="mozdev-navigation">
</div>

<!-- MAIN CONTENT -->

<div id="ae-content">

<p>The AE Creations website has moved.  Redirecting to <a href="http://aecreations.sourceforge.net/">http://aecreations.sourceforge.net</a>...</p>

</div> <!-- aecontent -->

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>