Friday, May 4

Code we must

If you're using the dotcomments discussion system by Foreword.com, and you want email notification and IP tracking, here's a modified version of their 4.26 release with those features. My thanks to Foreword.com for making their code available. I'm hugely happy with it.

I just whipped this version up by simplifying the code I'm using for the nosuch brand blogs. My code has some extra features, some incomplete, others not ready for prime-time, that I removed for this release. There's just two code blocks, one at the beginning with configuration variables, and one in the middle, that does the emailing, so you can just paste it into your exisiting code. My code assumes you are using Blogger, but if you're not, it just means the link to the source post in the email you get won't work. No guarantees this code will work on your web server, since it depends on the configuration of sendmail. It works on mine, and that's been my extremely limited experience.



Older entries

'; } else { if(stristr($filename,"archive")) { $dir=$_SERVER['DOCUMENT_ROOT']; $template='_01_archive.html'; $tail=strlen($template); $thisArchive=$filename; //$files=scandir($dir); $dh = opendir($dir); while (false !== ($filename = readdir($dh))) { $files[] = $filename; } sort($files); $earlyarch=""; $laterarch=""; $prevarch=""; $next=0; foreach($files as $file) { if (substr($file,-$tail)==$template) { if ($next==1) { $laterarch=$file; $earlyarch=$prevarch; $next=0; } if ($file==$thisArchive) { $next=1; } else { $prevarch=$file; $earlyarch=$prevarch; } } } $link=''; $divider=''; if(file_exists($earlyarch)) { $link='< Earlier Archive'; $divider=" | "; } if(file_exists($laterarch)) { $link=$link.$divider.'Later Archive >'; } $link=$link.'

'; } } echo($link); ?>