Greg
Web site conversion stuff
Greg's home page
Greg's diary
Greg's photos
Greg's links
Google
This page contains stuff I need to remember while I'm upgrading my web site. It's almost certainly of no use to anybody else.

Converting diary-foo.html to diary-foo.php

Version of 20 January 2026

Replace header with something like:

<!-- for Emacs, this is a -*- mode: html-fill; coding: utf-8 -*- document -->
<!-- $Id: burnt-out-socket.php,v 1.1 2023/01/16 02:14:36 grog Exp $ -->
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<?php
   /* title should start with a lower case character */
   $title = "burnt out pump power socket";
   include "header.php";
   $subtitle = "";
   javaheader ();
   include "css.php";
   $id = '$Id: burnt-out-socket.php,v 1.1 2023/01/16 02:14:36 grog Exp $';
 ?>

<html xmlns="http://www.w3.org/1999/xhtml">
  <head>
    <?php pagetitle ($title); ?>
  </head>

  <body>
    <?php pageheader ($title); ?>

    <div align="justify">
  • Version of 27 June 2008
    1. Remove header, replace with:
      <!-- for Emacs, this is a -*- html-fill -*- document -->
      <!-- $Id: diaryconvert.php,v 1.3 2010/09/06 02:11:36 grog Exp grog $ -->
      <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
          "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
      <?php
        include "header.php";
      ?>
      
      <html xmlns="http://www.w3.org/1999/xhtml">
        <head>
          <?php diary_title (); ?>
        </head>
      
        <body>
          <?php diary_header (); ?>
      
          <div align="justify">
      

      Optionally, add a different photo:

      
       <?php diary_header ('src="/grog/Photos/19641219/tiny/greg-detail.jpeg" width="238" height="300"'); ?>
      
      

    2. Replace footer with:
           </div>
          <?php diary_footer ($lastmonth, $nextmonth, '$Id: diaryconvert.php,v 1.3 2010/09/06 02:11:36 grog Exp grog $'); ?>
        </body>
      </html>
      
      
    3. Add daytitles. Fix the following by replacing the month name and number. First is day 1-9, second the rest.

      New version, to be fixed:

      
      (query-replace-regexp "<h2><a name=\".\">.*, \\(.\\) August 2007</a></h2>
      
       *<center>
       *<i>\\(.*\\)</i>
       *</center>" "<?php daytitle (\"2007080\\1\", \"\\2\"); ?>")
      
      (query-replace-regexp "<h2><a name=\"..">\">.*, \\(..\\) May 2007</a></h2>
       *<center>
       *<i>\\(.*\\)</i>
       *</center>" "<?php daytitle (\"200705\\1\", \"\\2\"); ?>")
      
    4. Replace img tags with showphoto. This needs fixing. Do each in sequence. New:
      ;; rename small images
      
      (query-replace-regexp "/small/" "/tiny/")
      
      ;;; convert the guts to showphoto
      (query-replace-regexp " src=\"\\(.*\\)/tiny\\([^\"]+\\)\".*" "
      
      <?php showphoto (\"\\1\\2\"); ?>")
      
      ;;; Remove crap before a showphoto
      
      ;;; (query-replace-regexp "      <a .*\"><img.*
      ;;; .*Click on the picture.*
      ;;;
      ;;;
      ;;; " "        ")
      
      
      (query-replace-regexp ".*\"><img.*
      .*Click on the picture.*
       *
       *
      " "        ")
      
      (query-replace-regexp ".*<a id=.*
      \\( *<\\?php\\)" "\\1")
      
      
      Old:
      (query-replace-regexp "<a.*<img.*
      .*
      .*src=\"\\(.*\\)tiny/\\([^\"]+\\)\".*" "<?php showphoto (\"\\1\\2\"); ?>" nil)
      
      (query-replace-regexp "<a.*<img.*
      .*src=\"\\(.*\\)tiny/\\([^\"]+\\)\".*" "<?php showphoto (\"\\1\\2\"); ?>" nil)
      
      ;; This one for gifs and things.
      
      (query-replace-regexp "<img.*src=\"Images/\\([^\"]+\\)\".*" "<?php showphoto (\"Photos/\\1\"); ?>" nil)
      
      ;; This one for older diary entries.
      
       (query-replace-regexp "<h2><a name=\"..\">.*, \\(..\\) August 2002</a></h2>"
      "<?php daytitle (\"200208\\1\", \"XXX\"); ?>")) nil)
      
      (query-replace-regexp "``" "“" nil (if (and transient-mark-mode mark-active)
      (region-beginning)) (if (and transient-mark-mode mark-active) (region-end)))
      
      (query-replace-regexp "''" "”" nil (if (and transient-mark-mode mark-active)
      (region-beginning)) (if (and transient-mark-mode mark-active) (region-end)))
      


    Greg's home page Greg's diary Greg's photos
    Valid XHTML 1.0! $Id: diaryconvert.php,v 1.3 2010/09/06 02:11:36 grog Exp grog $