var zoomy = "\n\

Create a Blog Announcements Box

\n\
\n\ \n\

\n\ \"\" \n\

\n\ \n\
\n\ \n\

Create an Anouncements Category

\n\
\n\ \n\

\n\ Use Wordpress and create a category called 'announce', and populate it with a few posts. Test to see that the rss feed works. \n\

\n\ \n\

\n\ If you're using some sort of nice URLS, it'll look like http://www.yourblog.com/feed/announce \n\

\n\ \n\

\n\ If not, it may look more like http://www.yourblog.com/?feed=rss2&category_name=announce \n\

\n\ \n\
\n\ \n\

PHP / DOM

\n\
\n\ \n\

\n\ Put this in includes/templates/YOUR_TEMPLATE/templates/tpl_index_default.php (we put it at the very bottom).\n\

\n\
<div id="announceBox">\n\
 \n\
<?php\n\
 \n\
$filename = \'http://yourblog.com/feed/announce\';   // Change this to your own feed\n\
$xml = new DOMDocument();\n\
$xml->load($filename);\n\
 \n\
$item = $xml->getElementsByTagName(\'item\')->item(0);\n\
$post_title = $item->getElementsByTagName(\'title\')->item(0)->nodeValue;\n\
$post_link = $item->getElementsByTagName(\'link\')->item(0)->nodeValue;\n\
$post_encoded  = $item->getElementsByTagName(\'encoded\')->item(0)->nodeValue;\n\
$post_text = substr (strip_tags ($post_encoded, \'<p><a><blockquote>\'), 0, 500);  // strip out common tags here\n\
if($post_text != strip_tags ($post_encoded, \'<p><a><blockquote>\'))\n\
  { // add read more tag\n\
 \n\
    $pre_cut = 499;\n\
    while( substr ($post_text, $pre_cut, 1) !== \' \' && $pre_cut > 0)\n\
      {\n\
	$pre_cut--;\n\
      }\n\
    $post_text = substr ($post_text, 0, $pre_cut);\n\
    $post_text .= \'... <a href="\'. $post_link .\'">Read More ...</a>\';\n\
  }\n\
 \n\
$post_text = str_replace (\'<p></p>\', \'\', $post_text);\n\
 \n\
// find the first image of the post\n\
$matches = array ();\n\
preg_match (\'/<img\\s+src="([^"]*)"/\', $post_encoded, $matches);\n\
$post_image = $matches[1];\n\
 \n\
 \n\
?>\n\
<table>\n\
<tr>\n\
<td>\n\
<div id="announceImgBox">\n\
<a href="<?php echo $post_link; ?>">\n\
<img src="<?php echo $post_image; ?>" />\n\
</a>\n\
</div>\n\
</td>\n\
<?php\n\
  }\n\
?>\n\
<td>\n\
<div id="announceTitle">\n\
  <a href="<?php echo $post_link; ?>"> <?php echo $post_title; ?></a>\n\
</div>\n\
<div id="announceText">\n\
<?php\n\
  echo $post_text;\n\
?>\n\
</div>\n\
</td>\n\
</tr>\n\
</table>\n\
</div>
\n\ \n\

\n\ This will work for rss feeds generated by Wordpress, but you'll have to add CSS and style it for your own website. \n\

\n\ \n\
\n\ ";document.write(zoomy);document.write("

This page was autogenerated from http://www.ladyada.net/wiki/tutorials/zencartmods/blog_announce.html
Please edit the wiki to contribute any updates or corrections.
")