Webcomics List Counter

AB Avatar

I noticed recently my comic listing was no longer being checked for updates on The Webcomic List website.. When I inquired as to why, Norah was able to help me with this letting me know its because I needed to have <!-- Last Update dd/mm/yyyy --> in the HTML code for the page listing the last date the comic was updated. Simple enough except that I use Drupal, the only HTML code on the site is generated via PHP scripts.

After a few days of testing, a little research on PHP script sites, and more help from Norah; I was able to piece together the right PHP code which updates the date code automatically every time I post a new comic, and the right placement of the code to get my site to work with the TWCL system.

So if you are running a webcomic on Drupal 7 you can insert this code into your theme's "html.tpl.php" document just after the <body> tag but before the </body> tag and it will update the date stamp in the generated HTML on it's own every time a new comic node is created:

<?php
// get date of most most recent change to a node
$result = db_query('SELECT title, changed FROM {node} WHERE status=1 ORDER BY changed DESC LIMIT 1');
$node = $result->fetchObject();
$date = date('d/m/Y', $node->changed);
echo "<!-- Last Update: $date -->" ;
?>

Taxonomy: 
Ad Space