mharc-users

Re: PHP files?

2004-01-13 13:06:19
On 12 Jan 2004, at 04:50 PM, I wrote:
Hi! I'd like to have mharc create .php files, instead of .html files, for output. I know that to change the name of the date and thread index files, I need to edit the .mrcs for MHonArc. However, I'm not sure where/what I need to edit to change the output from mharc itself (the period index) or to get MHonArc to use .php instead of .html for the actual message files.

Is this possible?

So, given the time frame, I went ahead and made modifications to web-archive to make this possible.

1) MHonArc supports a <htmlext> resource in mrc files. So that made that part easy.

2) for the rest, it's a matter of finding the hardcoded .html file names in web-archive and making them use a variable. Below is a diff of my web-archive and the original (web-archive.orig). This also includes my change to support different .PNM.head and .PNM.foot files for each list.

HTH,
Ricky

[archiver(_at_)hedwig bin]$ diff -u web-archive.orig web-archive
--- web-archive.orig    Fri Oct 31 16:17:53 2003
+++ web-archive Tue Jan 13 13:15:14 2004
@@ -108,6 +108,9 @@
   my $HTML_URL                 = $opt{'htmlurl'} ||
                                $config->{'HTML_URL'} ||
                                "$ROOT_URL/html";
+  my $HTML_EXT          = $opt{'htmlext'} ||
+                               $config->{'HTML_EXT'} ||
+                               "html";
   my $MBOX_DIR                 = $opt{'mboxdir'} ||
                                $config->{'MBOX_DIR'} ||
                                "$HOME/mbox";
@@ -176,7 +179,7 @@

   my $all_index         = $opt{'alllistsfile'} ||
                              $config->{'ALL_LISTS_FILE'} ||
-                             join('/', $HTML_DIR, 'lists.html');
+                             join('/', $HTML_DIR, "lists.$HTML_EXT");
   my $main_header      = $config->{'MAIN_HEADER'} ||
                              join('/', $HTML_DIR, '.PNM.head');
   my $main_footer      = $config->{'MAIN_FOOTER'} ||
@@ -499,7 +502,7 @@
     @months = reverse sort grep { /^$folder_regex/o } readdir(DIR);
     print "Month listing for main index: @months\n"  if $debug;
     closedir(DIR);
-    my $indexhtml = join('/', $htmldir, 'index.html');
+    my $indexhtml = join('/', $htmldir, "index.$HTML_EXT");
     if (!open(INDEX, ">$indexhtml.tmp")) {
       warn qq/Warning: Unable to open $htmldir for reading: $!\n/;
       next;
@@ -512,14 +515,27 @@
       'LIST-NAME'  => $list,
       'LIST-DESC'  => $title,
     );
+
+    if ($config->{'USE_ARCHIVE_MAIN_TEMPLATES'}) {
+ my $temp_head_name = $config->{'ARCHIVE_MAIN_HEADER_TEMPLATE'} || '.PNM.head'; + my $temp_foot_name = $config->{'ARCHIVE_MAIN_FOOTER_TEMPLATE'} || '.PNM.foot';
+
+       if (-f "$HTML_DIR/$temp_head_name.$list") {
+          $main_header = "$HTML_DIR/$temp_head_name.$list";
+       }
+       if (-f "$HTML_DIR/$temp_foot_name.$list") {
+          $main_footer = "$HTML_DIR/$temp_foot_name.$list";
+       }
+    }
+
     print_template(\*INDEX, $main_header, @vars);
     print INDEX "<ul>\n";
     foreach $mon (@months) {
       print INDEX qq|<li><b>$mon</b>:|;
-      print INDEX qq|&nbsp;&nbsp;<a href="$mon/index.html">[Date]</a>|
-         if (-e join('/', $htmldir, $mon, 'index.html'));
- print INDEX qq|&nbsp;&nbsp;<a href="$mon/threads.html">[Thread]</a>|
-         if (-e join('/', $htmldir, $mon, 'threads.html'));
+ print INDEX qq|&nbsp;&nbsp;<a href="$mon/index.$HTML_EXT">[Date]</a>|
+         if (-e join('/', $htmldir, $mon, "index.$HTML_EXT"));
+ print INDEX qq|&nbsp;&nbsp;<a href="$mon/threads.$HTML_EXT">[Thread]</a>|
+         if (-e join('/', $htmldir, $mon, "threads.$HTML_EXT"));

       if (!$listdef->{$listname}{'no-raw-link'}[0]) {
        my $raw_label = '[Raw: ]';
@@ -671,7 +687,7 @@
   my $mtime = 0;
   my $file;
   foreach $file (readdir(DIR)) {
-    next  unless $file =~ /^msg\d+\.html/;
+    next  unless $file =~ /^msg\d+\.${HTML_EXT}/;
     $mtime = (stat(join('/', $archive, $file)))[9];
     $latest = $mtime  if ($mtime > $latest);
   }
@@ -725,11 +741,11 @@
 #
 sub get_info_url {
   my %opts = @_;
-  my $pathname = join('/', $opts{'-dir'}, $opts{'-name'}) . '.html';
+ my $pathname = join('/', $opts{'-dir'}, $opts{'-name'}) . '.' . $HTML_EXT;
   if (! -e $pathname) {
     return undef;
   }
-  join('/',  $opts{'-baseurl'}, $opts{'-name'}) . '.html';
+  join('/',  $opts{'-baseurl'}, $opts{'-name'}) . '.' . $HTML_EXT;
 }

 ##  Generats the all-lists index.
@@ -848,10 +864,10 @@


     print IDX qq|<td>|;
- print IDX qq|&nbsp;<a href="$html_url/$list/$latest/index.html">$label_date</a>&nbsp;|
-       if (-e join('/', $dir, $latest, 'index.html'));
- print IDX qq|&nbsp;<a href="$html_url/$list/$latest/threads.html">$label_threads</a>&nbsp;|
-       if (-e join('/', $dir, $latest, 'threads.html'));
+ print IDX qq|&nbsp;<a href="$html_url/$list/$latest/index.$HTML_EXT">$label_date</a>&nbsp;|
+       if (-e join('/', $dir, $latest, "index.$HTML_EXT"));
+ print IDX qq|&nbsp;<a href="$html_url/$list/$latest/threads.$HTML_EXT">$label_threads</ a>&nbsp;|
+       if (-e join('/', $dir, $latest, "threads.$HTML_EXT"));
     print IDX qq|</td>\n|;

print IDX qq|<td>&nbsp;<tt>|, $last_updated, qq|</tt>&nbsp;</td>\n|;

---------------------------------------------------------------------
To sign-off this list, send email to majordomo(_at_)mhonarc(_dot_)org with the
message text UNSUBSCRIBE MHARC-USERS

<Prev in Thread] Current Thread [Next in Thread>
  • PHP files?, Richard Morse
    • Re: PHP files?, Richard Morse <=