Create base template for all project-specific pages
Create base template for all project-specific pages

--- a/templates/blame.tpl
+++ b/templates/blame.tpl
@@ -5,7 +5,7 @@
  *
  * Copyright (C) 2010 Christopher Han <xiphux@gmail.com>
  *}
-{extends file='main.tpl'}
+{extends file='projectbase.tpl'}
 
 {block name=main}
 

--- a/templates/blob.tpl
+++ b/templates/blob.tpl
@@ -5,7 +5,7 @@
  *
  *  Copyright (C) 2009 Christopher Han <xiphux@gmail.com>
  *}
-{extends file='main.tpl'}
+{extends file='projectbase.tpl'}
 
 {block name=javascript}
     <script src="js/ext/require.js"></script>

--- a/templates/blobdiff.tpl
+++ b/templates/blobdiff.tpl
@@ -5,7 +5,7 @@
  *
  *  Copyright (C) 2009 Christopher Han <xiphux@gmail.com>
  *}
-{extends file='main.tpl'}
+{extends file='projectbase.tpl'}
 
 {block name=main}
 

--- a/templates/commit.tpl
+++ b/templates/commit.tpl
@@ -5,7 +5,7 @@
  *
  *  Copyright (C) 2009 Christopher Han <xiphux@gmail.com>
  *}
-{extends file='main.tpl'}
+{extends file='projectbase.tpl'}
 
 {block name=main}
 

--- a/templates/commitdiff.tpl
+++ b/templates/commitdiff.tpl
@@ -5,7 +5,7 @@
  *
  *  Copyright (C) 2009 Christopher Han <xiphux@gmail.com>
  *}
-{extends file='main.tpl'}
+{extends file='projectbase.tpl'}
 
 {block name=javascript}
     <script src="js/ext/require.js"></script>

--- a/templates/heads.tpl
+++ b/templates/heads.tpl
@@ -5,7 +5,7 @@
  *
  *  Copyright (C) 2009 Christopher Han <xiphux@gmail.com>
  *}
-{extends file='main.tpl'}
+{extends file='projectbase.tpl'}
 
 {block name=main}
 

--- a/templates/history.tpl
+++ b/templates/history.tpl
@@ -5,7 +5,7 @@
  *
  *  Copyright (C) 2009 Christopher Han <xiphux@gmail.com>
  *}
-{extends file='main.tpl'}
+{extends file='projectbase.tpl'}
 
 {block name=main}
 

--- a/templates/log.tpl
+++ b/templates/log.tpl
@@ -5,7 +5,7 @@
  *
  *  Copyright (C) 2009 Christopher Han <xiphux@gmail.com>
  *}
-{extends file='main.tpl'}
+{extends file='projectbase.tpl'}
 
 {block name=main}
 

--- a/templates/main.tpl
+++ b/templates/main.tpl
@@ -13,12 +13,14 @@
 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
   <!-- gitphp web interface {$version}, (C) 2006-2011 Christopher Han <xiphux@gmail.com> -->
   <head>
-    <title>{$pagetitle}{if $project} :: {$project->GetProject()}{if $actionlocal}/{$actionlocal}{/if}{/if}</title>
+    <title>
+    {block name=title}
+    {$pagetitle}
+    {/block}
+    </title>
     <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
-    {if $project}
-      <link rel="alternate" title="{$project->GetProject()} log (Atom)" href="{$SCRIPT_NAME}?p={$project->GetProject()|urlencode}&amp;a=atom" type="application/atom+xml" />
-      <link rel="alternate" title="{$project->GetProject()} log (RSS)" href="{$SCRIPT_NAME}?p={$project->GetProject()|urlencode}&amp;a=rss" type="application/rss+xml" />
-    {/if}
+    {block name=feeds}
+    {/block}
     {if file_exists('css/gitphp.min.css')}
     <link rel="stylesheet" href="css/gitphp.min.css" type="text/css" />
     {else}
@@ -85,49 +87,16 @@
 	</form>
       </div>
       {/if}
-      <a href="index.php">{if $homelink}{$homelink}{else}{t}projects{/t}{/if}</a> / 
-      {if $project}
-        <a href="{$SCRIPT_NAME}?p={$project->GetProject()|urlencode}&amp;a=summary">{$project->GetProject()}</a>
-        {if $actionlocal}
-           / {$actionlocal}
-        {/if}
-        {if $enablesearch}
-          <form method="get" action="index.php" enctype="application/x-www-form-urlencoded">
-            <div class="search">
-              <input type="hidden" name="p" value="{$project->GetProject()}" />
-              <input type="hidden" name="a" value="search" />
-              <input type ="hidden" name="h" value="{if $commit}{$commit->GetHash()}{else}HEAD{/if}" />
-              <select name="st">
-                <option {if $searchtype == 'commit'}selected="selected"{/if} value="commit">{t}commit{/t}</option>
-                <option {if $searchtype == 'author'}selected="selected"{/if} value="author">{t}author{/t}</option>
-                <option {if $searchtype == 'committer'}selected="selected"{/if} value="committer">{t}committer{/t}</option>
-                {if $filesearch}
-                  <option {if $searchtype == 'file'}selected="selected"{/if} value="file">{t}file{/t}</option>
-                {/if}
-              </select> {t}search{/t}: <input type="text" name="s" {if $search}value="{$search}"{/if} />
-            </div>
-          </form>
-        {/if}
-      {/if}
+      {block name=header}
+      <a href="index.php">{if $homelink}{$homelink}{else}{t}projects{/t}{/if}</a> /
+      {/block}
     </div>
 {block name=main}
 
 {/block}
     <div class="page_footer">
-      {if $project}
-        <div class="page_footer_text">
-	{if $project->GetWebsite()}
-	<a href="{$project->GetWebsite()}">{$project->GetDescription()}</a>
-	{else}
-	{$project->GetDescription()}
-	{/if}
-	</div>
-        <a href="{$SCRIPT_NAME}?p={$project->GetProject()|urlencode}&amp;a=rss" class="rss_logo">{t}RSS{/t}</a>
-        <a href="{$SCRIPT_NAME}?p={$project->GetProject()|urlencode}&amp;a=atom" class="rss_logo">{t}Atom{/t}</a>
-      {else}
-        <a href="{$SCRIPT_NAME}?a=opml" class="rss_logo">{t}OPML{/t}</a>
-        <a href="{$SCRIPT_NAME}?a=project_index" class="rss_logo">{t}TXT{/t}</a>
-      {/if}
+      {block name=footer}
+      {/block}
     </div>
     <div class="attr_footer">
     	<a href="http://xiphux.com/programming/gitphp/" target="_blank">GitPHP by Chris Han</a>

--- a/templates/project.tpl
+++ b/templates/project.tpl
@@ -5,7 +5,7 @@
  *
  *  Copyright (C) 2009 Christopher Han <xiphux@gmail.com>
  *}
-{extends file='main.tpl'}
+{extends file='projectbase.tpl'}
 
 {block name=main}
 

--- /dev/null
+++ b/templates/projectbase.tpl
@@ -1,1 +1,58 @@
+{*
+ * Projectbase
+ *
+ * Base template for all pages for a single project
+ *
+ * @author Christopher Han <xiphux@gmail.com>
+ * @copyright Copyright (c) 2011 Christopher Han
+ * @packge GitPHP
+ * @subpackage Template
+ *}
+{extends file='main.tpl'}
 
+{block name=title}
+{$pagetitle} :: {$project->GetProject()}{if $actionlocal}/{$actionlocal}{/if}
+{/block}
+
+{block name=feeds}
+  <link rel="alternate" title="{$project->GetProject()} log (Atom)" href="{$SCRIPT_NAME}?p={$project->GetProject()|urlencode}&amp;a=atom" type="application/atom+xml" />
+  <link rel="alternate" title="{$project->GetProject()} log (RSS)" href="{$SCRIPT_NAME}?p={$project->GetProject()|urlencode}&amp;a=rss" type="application/rss+xml" />
+{/block}
+
+{block name=header}
+  <a href="index.php">{if $homelink}{$homelink}{else}{t}projects{/t}{/if}</a> / 
+  <a href="{$SCRIPT_NAME}?p={$project->GetProject()|urlencode}&amp;a=summary">{$project->GetProject()}</a>
+  {if $actionlocal}
+     / {$actionlocal}
+  {/if}
+  {if $enablesearch}
+    <form method="get" action="index.php" enctype="application/x-www-form-urlencoded">
+      <div class="search">
+        <input type="hidden" name="p" value="{$project->GetProject()}" />
+        <input type="hidden" name="a" value="search" />
+        <input type ="hidden" name="h" value="{if $commit}{$commit->GetHash()}{else}HEAD{/if}" />
+        <select name="st">
+          <option {if $searchtype == 'commit'}selected="selected"{/if} value="commit">{t}commit{/t}</option>
+          <option {if $searchtype == 'author'}selected="selected"{/if} value="author">{t}author{/t}</option>
+          <option {if $searchtype == 'committer'}selected="selected"{/if} value="committer">{t}committer{/t}</option>
+          {if $filesearch}
+            <option {if $searchtype == 'file'}selected="selected"{/if} value="file">{t}file{/t}</option>
+          {/if}
+        </select> {t}search{/t}: <input type="text" name="s" {if $search}value="{$search}"{/if} />
+      </div>
+    </form>
+  {/if}
+{/block}
+
+{block name=footer}
+  <div class="page_footer_text">
+  {if $project->GetWebsite()}
+  <a href="{$project->GetWebsite()}">{$project->GetDescription()}</a>
+  {else}
+  {$project->GetDescription()}
+  {/if}
+  </div>
+  <a href="{$SCRIPT_NAME}?p={$project->GetProject()|urlencode}&amp;a=rss" class="rss_logo">{t}RSS{/t}</a>
+  <a href="{$SCRIPT_NAME}?p={$project->GetProject()|urlencode}&amp;a=atom" class="rss_logo">{t}Atom{/t}</a>
+{/block}
+

--- a/templates/projectlist.tpl
+++ b/templates/projectlist.tpl
@@ -134,4 +134,9 @@
 
 {/block}
 
+{block name=footer}
+  <a href="{$SCRIPT_NAME}?a=opml" class="rss_logo">{t}OPML{/t}</a>
+  <a href="{$SCRIPT_NAME}?a=project_index" class="rss_logo">{t}TXT{/t}</a>
+{/block}
 
+

--- a/templates/search.tpl
+++ b/templates/search.tpl
@@ -5,7 +5,7 @@
  *
  *  Copyright (C) 2009 Christopher Han <xiphux@gmail.com>
  *}
-{extends file='main.tpl'}
+{extends file='projectbase.tpl'}
 
 {block name=main}
 

--- a/templates/searchfiles.tpl
+++ b/templates/searchfiles.tpl
@@ -5,7 +5,7 @@
  *
  *  Copyright (C) 2009 Christopher Han <xiphux@gmail.com>
  *}
-{extends file='main.tpl'}
+{extends file='projectbase.tpl'}
 
 {block name=main}
 

--- a/templates/shortlog.tpl
+++ b/templates/shortlog.tpl
@@ -5,7 +5,7 @@
  *
  *  Copyright (C) 2009 Christopher Han <xiphux@gmail.com>
  *}
-{extends file='main.tpl'}
+{extends file='projectbase.tpl'}
 
 {block name=main}
 

--- a/templates/tag.tpl
+++ b/templates/tag.tpl
@@ -5,7 +5,7 @@
  *
  *  Copyright (C) 2009 Christopher Han <xiphux@gmail.com>
  *}
-{extends file='main.tpl'}
+{extends file='projectbase.tpl'}
 
 {block name=main}
 

--- a/templates/tags.tpl
+++ b/templates/tags.tpl
@@ -5,7 +5,7 @@
  *
  *  Copyright (C) 2009 Christopher Han <xiphux@gmail.com>
  *}
-{extends file='main.tpl'}
+{extends file='projectbase.tpl'}
 
 {block name=main}
 

--- a/templates/tree.tpl
+++ b/templates/tree.tpl
@@ -5,7 +5,7 @@
  *
  *  Copyright (C) 2009 Christopher Han <xiphux@gmail.com>
  *}
-{extends file='main.tpl'}
+{extends file='projectbase.tpl'}
 
 {block name=javascript}
     <script src="js/ext/require.js"></script>

comments