Unify opml template
Unify opml template

--- a/include/display.git_opml.php
+++ b/include/display.git_opml.php
@@ -9,8 +9,6 @@
 
  require_once('util.script_url.php');
  require_once('gitutil.git_read_projects.php');
- require_once('gitutil.git_read_head.php');
- require_once('gitutil.git_read_commit.php');
 
 function git_opml($projectroot,$projectlist)
 {
@@ -19,32 +17,19 @@
 	header("Content-type: text/xml; charset=UTF-8");
 	$tpl->clear_all_assign();
 	$tpl->assign("title",$gitphp_conf['title']);
-	$tpl->display("opml_header.tpl");
-	echo "\n";
+	$tpl->assign("self",script_url());
+	$opmllist = array();
 	foreach ($projlist as $cat => $plist) {
 		if (is_array($plist)) {
 			foreach ($plist as $i => $proj) {
-				$head = git_read_head($projectroot . $proj);
-				$co = git_read_commit($projectroot . $proj, $head);
-				$tpl->clear_all_assign();
-				$tpl->assign("proj",$proj);
-				$tpl->assign("self",script_url());
-				$tpl->display("opml_item.tpl");
-				echo "\n";
+				$opmllist[] = $proj;
 			}
 		} else {
-			$head = git_read_head($projectroot . $plist);
-			$co = git_read_commit($projectroot . $plist, $head);
-			$tpl->clear_all_assign();
-			$tpl->assign("proj",$plist);
-			$tpl->assign("self",script_url());
-			$tpl->display("opml_item.tpl");
-			echo "\n";
+			$opmllist[] = $plist;
 		}
 	}
-
-	$tpl->clear_all_assign();
-	$tpl->display("opml_footer.tpl");
+	$tpl->assign("opmllist",$opmllist);
+	$tpl->display("opml.tpl");
 }
 
 ?>

file:a/index.php -> file:b/index.php
--- a/index.php
+++ b/index.php
@@ -31,7 +31,8 @@
  if (isset($_GET['a']) &&
      ($_GET['a'] != "commitdiff_plain") &&
      ($_GET['a'] != "blob_plain") &&
-     ($_GET['a'] != "blobdiff_plain")) {
+     ($_GET['a'] != "blobdiff_plain") &&
+     ($_GET['a'] != "opml")) {
 	$tpl->load_filter('output','trimwhitespace');
 }
 

--- /dev/null
+++ b/templates/opml.tpl
@@ -1,1 +1,23 @@
+{*
+ *  opml.tpl
+ *  gitphp: A PHP git repository browser
+ *  Component: OPML template
+ *
+ *  Copyright (C) 2009 Christopher Han <xiphux@gmail.com>
+ *}
+<?xml version="1.0" encoding="utf-8"?>
+<opml version="1.0">
+  <head>
+    <title>{$title} OPML Export</title>
+  </head>
+  <body>
+    <outline text="git RSS feeds">
 
+      {foreach from=$opmllist item=proj}
+      <outline type="rss" text="{$proj}" title="{$proj}" xmlUrl="{$self}?p={$proj}&amp;a=rss" htmlUrl="{$self}?p={$proj}&amp;a=summary" />
+
+      {/foreach}
+    </outline>
+  </body>
+</opml>
+

--- a/templates/opml_footer.tpl
+++ /dev/null
@@ -1,11 +1,1 @@
-{*
- *  opml_footer.tpl
- *  gitphp: A PHP git repository browser
- *  Component: OPML footer template
- *
- *  Copyright (C) 2006 Christopher Han <xiphux@gmail.com>
- *}
- </outline>
- </body>
- </opml>
 

--- a/templates/opml_header.tpl
+++ /dev/null
@@ -1,16 +1,1 @@
-{*
- *  opml_header.tpl
- *  gitphp: A PHP git repository browser
- *  Component: OPML header template
- *
- *  Copyright (C) 2006 Christopher Han <xiphux@gmail.com>
- *}
-<?xml version="1.0" encoding="utf-8"?>
-<opml version="1.0">
-<head>
-  <title>{$title} OPML Export</title>
-</head>
-<body>
-<outline text="git RSS feeds">
 
-

file:a/templates/opml_item.tpl (deleted)
--- a/templates/opml_item.tpl
+++ /dev/null
@@ -1,9 +1,1 @@
-{*
- *  opml_item.tpl
- *  gitphp: A PHP git repository browser
- *  Component: OPML item template
- *
- *  Copyright (C) 2006 Christopher Han <xiphux@gmail.com>
- *}
-<outline type="rss" text="{$proj}" title="{$proj}" xmlUrl="{$self}?p={$proj}&amp;a=rss" htmlUrl="{$self}?p={$proj}&amp;a=summary"/>
 

comments