Website tablecg fix

Dylan Reinhold dylan at ocnetworking.com
Sat Jan 31 15:36:48 PST 2004


Attached is a patch of tablecg.c to show the page title in the browser's 
title bar.

Changes:
Moved the table generation to after the point where the page it self is 
 processed.

To see new output...
http://dragonfly.ocnetworking.com/Main/index.cgi
Thanks,
Dylan
Index: tablecg.c
===================================================================
RCS file: /home/dragonfly/cvsroot/site/src/tablecg.c,v
retrieving revision 1.9
diff -u -r1.9 tablecg.c
--- tablecg.c   12 Jan 2004 21:01:28 -0000      1.9
+++ tablecg.c   31 Jan 2004 23:29:50 -0000
@@ -137,15 +137,6 @@
     fflush(stdout);

     /*
-     * Generate table structure
-     */
-    printf("<HTML>\n");
-    printf("<HEAD>\n");
-    printf("<TITLE></TITLE>\n");
-    printf("<LINK REL=\"stylesheet\" HREF=\"/stylesheet.css\" TYPE=\"text/css\">");
-    printf("</HEAD>\n");
-    printf("<BODY>\n");
-    /*
      * Process body
      */
     if (FilePath[0] && (fi = fopen(FilePath, "r")) != NULL) {
@@ -182,6 +173,24 @@
        }
        fclose(fi);
     }
+    /*
+     * Generate table structure
+     * dr: Moved table structure below the reading of the web page to allow the title tags to populate.
+     */
+    printf("<HTML>\n");
+    printf("<HEAD>\n");
+
+       if (Title) {
+    printf("<TITLE>%s</TITLE>\n", Title);
+       }
+       else {
+    printf("<TITLE>DragonFly</TITLE>\n");
+       }
+
+    printf("<LINK REL=\"stylesheet\" HREF=\"/stylesheet.css\" TYPE=\"text/css\">");
+    printf("</HEAD>\n");
+    printf("<BODY>\n");
+
     printf("<TABLE BORDER=0 WIDTH=100%% BGCOLOR=\"#FFFFFF\">\n");
     printf("<TR><TD ALIGN=CENTER COLSPAN=2>");





More information about the Submit mailing list