|
Pages: [1]
|
 |
|
Author
|
Topic: Creating tables? (Read 698 times)
|
kmo
RootsChat Senior
   
Offline
Posts: 421

|
I've been tinkering about seeing if i can create a webpage for a Family History Societies Members Interests. Basically a table with six columns and a couple of thousand rows. Aftera few false starts I made it in Word using the create a table function and saving the end result as a webpage. It opens (eventually) in Internet Explorer and looks ok. If I open it with Notepad, the content is buried in reams of formatting! My problem is the page is 2MB! A bit unwieldy? Any suggestions for lightening the load?
|
|
|
|
|
Logged
|
|
|
|
|
|
Berlin-Bob
Global Moderator
RootsChat Marquessate
      
Offline
Posts: 5067

by My Daughter. Chatting to find her Roots !
|
Hi kmo,
Zeb's solution is the best one for large databases, but if you don't fancy it, or there is no PHP on the site you are working on, then try this:
the basic table tags are these:
| <table> | start table | </table> | end table | | <tr> | start a line | </tr> | end a line | | <td> | start a cell | </td> | end a cell |
so for a six column table, if you make this structure in Notepad, then you can use any "<tr> . . . </tr>" line as a template and repeat as often as you want.
<table border=1> <tr><td> </td><td> </td><td> </td><td> </td><td> </td><td> </td></tr> <tr><td> </td><td> </td><td> </td><td> </td><td> </td><td> </td></tr> <tr><td> </td><td> </td><td> </td><td> </td><td> </td><td> </td></tr> <tr><td> </td><td> </td><td> </td><td> </td><td> </td><td> </td></tr> <tr><td> </td><td> </td><td> </td><td> </td><td> </td><td> </td></tr> : : : : <tr><td> </td><td> </td><td> </td><td> </td><td> </td><td> </td></tr> <tr><td> </td><td> </td><td> </td><td> </td><td> </td><td> </td></tr> <tr><td> </td><td> </td><td> </td><td> </td><td> </td><td> </td></tr> <tr><td> </td><td> </td><td> </td><td> </td><td> </td><td> </td></tr> </table>
Replace the with your text for that cell. Leave it in for empty cells, and then the borders will also be drawn.
It's monotous, rather than hard, and two thousand lines sound like a lot, but bit by bit, "stay after school and write a 100 lines" till it's all done
Good luck, Bob
|
|
|
|
|
Logged
|
Searching for Coleman, Moore, Kallnung in London; Margulies, Remenyi in E. Europe; Ancestors of Hessie Stevenson-Coleman-Baxter (Ireland, 1861) and, of course, any other ancestors for my web-site http://boco.rootschat.net All Census Data included in this post is Crown Copyright (see: www.nationalarchives.gov.uk)
|
|
|
kmo
RootsChat Senior
   
Offline
Posts: 421

|
Thanks for the replies. I have no problem making the table. Made it in Word, using the create a table function. Copy and pasted the data into it from a database and saved the finished article as a webpage. Word does all the formatting. My problem is the size of the finished page.
|
|
|
|
|
Zeb
RootsChat Senior
   
Offline
Posts: 431

|
You could perhaps split it into sections like A, B, C, D etc. then that would give you 26 pages. I take it BRE is an area so maybe split it into areas?
Here's another idea...
If you can paste it all into Word can you paste it into an Excel spreadsheet? If you can its possible to save it out (export) as a CSV file. This is a plain text file which can then be used to insert into a MySQL database. The end product can be viewed any way you want in any order and you won't have loads of files on the server. Just a database and a couple of files.
Searching would be like: 1. abra* (show all starting with "abra") 2. *son (Show all ending in "son") 3. *son* (Show all containing "son") 4. bre (Show all columns containing "BRE") The results can be displayed in alphabetical order or reverse order. You can search on anything including any in a certain year.
I've got a lot of spare time on my hands at the moment. All I'm doing is writing the RC Guestbook and waiting for work to start on a large retro website. If you want a hand with it PM me...
|
|
|
|
|
Logged
|
Derby: WOODCOCK (Donnington) Devon: HARRIS (Plymouth) Lancashire: DERRICK Lincolnshire: CROPPER, WOODCOCK (Boston) London: BARKER, DUGGIN, HARRIS, HINTON, HULBERT, WHITE Wales: HARRIS, PRITCHARD (Pembrokeshire) Warwickshire: DERRICK, WOODCOCK Desperate for my Woodcocks from Birmingham!
|
|
|
downside
RootsChat Aristocrat
     
Offline
Posts: 2485

Make my day
|
Hi kmo
Word inserts a lot of xml code when it outputs your Word document as a webpage. You could do as Bob says write your own HTML version using Notepad but you would have to do a lot of typing in order to insert all those HTML tags. I know a way of doing this using a combimation of JavaScript and HTML but if you are not computer savvy then you might feel a little lost.
Basically you could create a comma separated file from your database program and save as text:
RowNumber,"1683","Abraham","Abraham","Llangyndir","BRE","1826+"
If you can, you should add a row number to each row starting at 0.
You then have to then add some JavaScript lines to your saved text file:
var individual = new Array() { function record (fieldOne, fieldTwo,fieldThree,fieldFour,fieldFive,fieldSix) { this.firstOne = fieldOne; this.fieldTwo = fieldTwo; this.fieldThree = fieldThree; this.fieldFour = fieldFour; this.fieldFive = fieldFive; this.fieldSix = fieldSix; }
function createIndividual {
individual[0] = new record("1683","Abraham","Abraham","Llangyndir","BRE","1826+");
load of rows etc.
}
OK - so for each row you need to insert that row number between the square brackets. At the very end of the file you must add a curly brace }. Save the file as mytableDB.js.
Now you have to create a file that opens your database as a webpage. We'll call it mytable.htm.
Enter the following code in a blank Notepad file:
<htm> <head> <script language="JavaScript" type="text/javascript" src="mytableDB.js"></script> </head> <body> <script language="JavaScript" type="text/javascript">
createIndividual ();
document.write("<table border=1>"); for (i = 0 ; i < individual.length; i++) { document.write("<tr><td>" +individual[i]. fieldOne + "</td><td>" + individual[i].fieldTwo + "</td><td>" + individual[i].fieldThree + "</td><td>" + individual[i].fieldFour + "</td><td>" + individual[i].fieldFive + "</td><td>" + individual[i].fieldSix + "</td></tr>" ); }
document.write("</table>"); </script> </body> </html>
Now save the file as mytable.htm.
Effectively, the for loop will write your entire database to the screen. The advantage of doing things this way is that you do not have to perform the tedious task of inserting all those <td> and </td> tags between each of the datafields as in a static HTML document.
If you have your data in an Access database then you could create an extra field when you output a query so that it contains:
individual[
followed by the row number field, and then another extra field
] = new record(
this will cut down on the amount of typing you would have to do. You can also use the Search and Replace function within Notepad to reduce the amount of work you would have to do.
If you have empty data cells then you may need to insert " " into the mytableDB.js file so that the cells are properly formed.
downside
|
|
|
|
|
Logged
|
Sussex: Floate, West Kent: Tuffee Cheshire: Gradwell
|
|
|
Zeb
RootsChat Senior
   
Offline
Posts: 431

|
downside, the main problem with that is that you have to get Excel (presuming the database is stored in Excel) to save the data out as a CSV file - thats the type of text file you're describing when you say to add commas between the data. If the data isn't stored in Excel then thats a LOT of converting to do.
Then there's the task or converting each line of data to javascript, ie:individual[0] = new record("1683","Abraham","Abraham","Llangyndir","BRE","1826+"); and more code for each line Its a nice idea but as javascript is client-side the converting of all that data will only be as fast as the user's computer. If they're running other applications at the same time then it could take a long time.
If the data is stored in a CSV file then it might as well be uploaded and inserted into a MySQL database using a simple script then having a separate script to view the data. The second script would only be as complex as desired (ie. displayed in order of a set column, displayed by the user choosing which column, searching for data, paginating the display results etc.)
As PHP is server-side it frees the end user's computer up and removes the risk of one stray piece of data messing the entire display whereas PHP/MySQL would always return safe data.
|
|
|
|
|
Logged
|
Derby: WOODCOCK (Donnington) Devon: HARRIS (Plymouth) Lancashire: DERRICK Lincolnshire: CROPPER, WOODCOCK (Boston) London: BARKER, DUGGIN, HARRIS, HINTON, HULBERT, WHITE Wales: HARRIS, PRITCHARD (Pembrokeshire) Warwickshire: DERRICK, WOODCOCK Desperate for my Woodcocks from Birmingham!
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Pages: [1]
|
|
|
|
|