Template Audit

Description

Lists live/working templates in alpha order and which live/working html pages are using them.

Very basic, can probably be configured to list more helpful information.

Code

## template audit
## uses direct database queries to list each extant templates
## and which live html pages are using it.
## Jonathan Laughlin <jlaughli@calvin.edu>
## Nov 14, 2011

#getSQLResults("SELECT inode,title FROM template WHERE live = 1 AND working = 1 AND deleted = 0 ORDER BY title asc")
#set($templateInfo = $results)

#foreach($t in $templateInfo)
<p>
 <strong>$t.title</strong><br/>
 #set($templateInode = $t.inode)
 #getSQLResults("SELECT identifier FROM inode WHERE inode = '$templateInode'")
 #foreach($i in $results)
  #if($velocityCount == 1)
   #set($templateIdentifier = $i.identifier)
  #end
 #end
 
 #getSQLResults("select * from htmlpage where live = 1 and working = 1 and deleted = 0 and inode in (select child from tree where parent = '$templateIdentifier') order by title asc")
 #foreach($a in $results)
   $a.title<br/>
 #end
</p>
#end
​