HTML question

Discuss all aspects of programming here.

Moderator: The Mod Squad

HTML question

Postby Kenny Rogers » Tue Aug 03, 2004 8:22 am

This post has been forwarded from another forum.

I've created a website for a friend and I wish to make the job of updating the site easy for him. What will need to be regularly updated is spreadsheet data, which I have tabled on the main HTML page.

Is there any way to insert spreadsheet data directly into an HTML document without having to create a massive table with thousands of <tr><td></td></tr> tags? Someone mentioned linking a spreadsheet to the HTML file.

Thanks,

Ken
Kenny Rogers
Brown Belt
Brown Belt
 
Posts: 303
Joined: Tue Jan 07, 2003 4:38 am

use a programming language

Postby tryn » Tue Aug 03, 2004 8:38 am

The easiest method I know is to create the table you are looking for is to use a programming language like PHP to run a loop. I would suggest dumping the spreadsheet information into a relational database. You need to query your database and force the loop to iterate as many times as the number of results your query generates.

You can hard code the <table></table> tags outside the loop.

sample code(this won't work without the SQL query or data variables)

$results = (the number of results returned from the query);

for (i = 0; i < $results; i++)
{
echo "<tr><td>[color=blue](your actual data)
</td></tr>";
}
[/color]

The idea is to get the programming language you use to do the drudge work of making all the tags you will need. The above sample is PHP, but you can use any language to create the loop.

Why is the data in a spreadsheet format? I'm not sure if a spreadsheet will be useful to publish directly to HTML, I've never tried it. My firts steps would be to convert the data into a comma delimited flat file or import the data into a database program.

tryn
tryn
Initiate
Initiate
 
Posts: 85
Joined: Tue Mar 25, 2003 5:49 pm

Postby Kenny Rogers » Tue Aug 03, 2004 11:37 am

Holy smokes, I'm lost. I'm not much of a programmer. Just trying to get the hang of HTML. Here is a link to the page I'm talking about.

http://www3.telus.net/preciouseffects/GHUU

I built this table to organise his bookings. How would he (who is quite HTML illiterate) update the table of information on the page? I could explain how to update the table (eg. <td>information</td>) but I think it would be great if he could somehow just upload a spreadsheet or word document to his web server, and it would automatically appear. Any thoughts?

Ken
Kenny Rogers
Brown Belt
Brown Belt
 
Posts: 303
Joined: Tue Jan 07, 2003 4:38 am

Postby Hardware Junkie » Tue Aug 03, 2004 5:49 pm

Easiest thing to do would be to load the spreadsheet into Word and change it from there.

You can do something in Word and Save As HTML.

Image
"Imagination is the only weapon in the war against reality." -Jules de Gautier

Image
Hardware Junkie
Mobo-fu Master
Mobo-fu Master
 
Posts: 19405
Joined: Thu Jan 25, 2001 1:01 am
Location: 00000h - 0000Fh

.

Postby Kenny Rogers » Tue Aug 03, 2004 8:14 pm

Great, thank you. My friend says he uses Word for his data table anyhow (not Excel as I mentioned earlier). So can I take a word document, save it as HTML, and embed it into the web page mentioned above? You see, the whole page is a table, and I'd like a word document to become a cell of that table.

Ken
Kenny Rogers
Brown Belt
Brown Belt
 
Posts: 303
Joined: Tue Jan 07, 2003 4:38 am

Postby Hardware Junkie » Tue Aug 03, 2004 8:29 pm

You want to have a table and have a word document loaded into each cell? That's not going to work. I can't even fathom the code to make that work.

But you can make the table in word and update each cell that way. Then upload the entire table when finished.
"Imagination is the only weapon in the war against reality." -Jules de Gautier

Image
Hardware Junkie
Mobo-fu Master
Mobo-fu Master
 
Posts: 19405
Joined: Thu Jan 25, 2001 1:01 am
Location: 00000h - 0000Fh

.

Postby Kenny Rogers » Tue Aug 03, 2004 8:35 pm

That's a great idea. Although I'm not sure how to put my rollovers, image mapping and .gif animations into the word document. I'll see what I can do. My goal here is to make a website with a list that is easy for somebody to update.
Kenny Rogers
Brown Belt
Brown Belt
 
Posts: 303
Joined: Tue Jan 07, 2003 4:38 am

.

Postby Kenny Rogers » Tue Aug 03, 2004 8:58 pm

I've figured out something that will work well for this guy. I've put all his data into a list, and that list will exist within a cell on the web page. He can easily swim through all the confusing HTML and find the list below, which just about anybody could update, without knowing one stitch of HTML.


<UL>


<!-- ENTER DATA BELOW! -->
<!-- ENTER DATA BELOW! -->
<!-- ENTER DATA BELOW! -->



<li> Aug 1 9am to noon Randal [local]
<li> Aug 1 noon to 4pm Aird
<li> Aug 4,5 and 6 Randal [Sunshine coast]
<li> Aug 20 to 22 Gerry [ Alert Bay]
<li> Aug 25 Shawn [Penticton]
<li> Sept 4,5 and 6 Randal [Portland]
<li> Sept 11 to 17 Ken [ Reno]
<li> Sept 18 to 20 Hans [ Prince George]
<li> Oct 9 to 11 Hans [Merrit/Quilchina]



<!-- ENTER DATA ABOVE! -->
<!-- ENTER DATA ABOVE! -->
<!-- ENTER DATA ABOVE! -->


</UL>
Kenny Rogers
Brown Belt
Brown Belt
 
Posts: 303
Joined: Tue Jan 07, 2003 4:38 am

grin...

Postby tryn » Wed Aug 04, 2004 7:23 am

Nice solution! Sorry if my "solution" threw you for a loop! (pun intended)

I have one question. It is easy for programmers to understand what "data" means. Why do you use "Enter Data Here" instead of something like "Enter Flight Here", "Enter Departure Time Here", "Enter Destination Here"?

I tend to try and think long term and if you are already putting a comment in the HTML to indicate where to update things, wouldn't it be useful long term to be more specific with what data should go in the commented areas? A year down the road, someone completely unaware of how this web page is set up to work will be in charge of updating it.

tryn
tryn
Initiate
Initiate
 
Posts: 85
Joined: Tue Mar 25, 2003 5:49 pm

Postby Kenny Rogers » Wed Aug 04, 2004 7:17 pm

Smart thinking. I'll do just that. Thanks for your replies.

K-K-Ken
Kenny Rogers
Brown Belt
Brown Belt
 
Posts: 303
Joined: Tue Jan 07, 2003 4:38 am

Next

Return to Programming

Who is online

Users browsing this forum: DotBot [Bot] and 0 guests