Hi,
I am looking for a way to populate an HTML table from an external
local text file which looks like this:
DATE/TIME LAT. LON. DEPTH. ML.
-------------------- ---------- ---------- ------- -------
21/03/2005-04:06:03 XX,XX XX,XX 171 3,42
21/03/2005-12:23:53 XX,XX XX,XX 500 5,4
21/03/2005-12:43:10 XX,XX XX,XX 553 5,38
21/03/2005-18:47:51 XX,XX XX,XX 162 3,91
21/03/2005-19:29:49 XX,XX XX,XX 500 3,51
21/03/2005-20:04:51 XX,XX X,X 75 3,72
The file could have more rows (DATA) that I show here. The file is
provided to me on a daily basis and I have to update a web page daily
with the contents of the file.
I considered using JavaScript embedded in the HTML page but I am a
newbie on what scripting for the web it refers.
How can I populate the HTML table with this text file which changes
everyday.
Also, is it possible to use php client-side only, without a server?
Your help, suggestions and feedback questions will be much
appreciated.
Thanks.
Alex. 11 8147
alex (al************ **@hotmail.com) wrote:
: Hi,
: I am looking for a way to populate an HTML table from an external
: local text file which looks like this:
: DATE/TIME LAT. LON. DEPTH. ML.
: -------------------- ---------- ---------- ------- -------
: 21/03/2005-04:06:03 XX,XX XX,XX 171 3,42
: 21/03/2005-12:23:53 XX,XX XX,XX 500 5,4
: 21/03/2005-12:43:10 XX,XX XX,XX 553 5,38
: 21/03/2005-18:47:51 XX,XX XX,XX 162 3,91
: 21/03/2005-19:29:49 XX,XX XX,XX 500 3,51
: 21/03/2005-20:04:51 XX,XX X,X 75 3,72
the absolutely easiest way is to simply wrap the above text with the <pre>
</pre> tags.
<html>
<head> <title> data from 21/03/2005 </title> </head>
<body>
<pre>
DATE/TIME LAT. LON. DEPTH. ML.
-------------------- ---------- ---------- ------- -------
21/03/2005-04:06:03 XX,XX XX,XX 171 3,42
21/03/2005-12:23:53 XX,XX XX,XX 500 5,4
</pre>
</body>
</html>
--
This space not for rent.
Malcolm Dew-Jones wrote: alex (al************ **@hotmail.com) wrote: : Hi,
: I am looking for a way to populate an HTML table from an external : local text file which looks like this:
(knip)
the absolutely easiest way is to simply wrap the above text with the <pre> </pre> tags.
That's not an HTML table... :S
Using server-side php it's not that difficult. You can generate the HTML
table only one-a-day, or always on the fly...
Read the file, split up the colums, and generate some table code, while
putting the values in it.
Here's one example how you can read the file. This one creates an array
with all the values, but of course you can print the table-html directly.
<pre>
<?php
$handle = fopen("./data.txt", 'r');
$elements = array();
while ($line = trim(fgets($han dle))) {
$elements[] = preg_split("/[\s]+/", $line);
# or:
# $foo = preg_split("/[\s]+/", $line);
# ?><tr><td><?=$f oo[0]?></td><td><?=$foo[1]?></td></tr> etc...
}
fclose($handle) ;
print_r($elemen ts);
?>
</pre>
output:
Array
(
[0] => Array
(
[0] => 21/03/2005-04:06:03
[1] => XX,XX
[2] => XX,XX
[3] => 171
[4] => 3,42
)
[1] => Array
(
[0] => 21/03/2005-12:23:53
[1] => XX,XX
[2] => XX,XX
[3] => 500
[4] => 5,4
)
)
Hans
--
"He who asks a question is a fool for five minutes;
he who does not ask a question remains a fool forever"
Carved in mystic runes upon the very living rock, the last words of alex
<al************ **@hotmail.com> of comp.lang.javas cript make plain: I am looking for a way to populate an HTML table from an external local text file which looks like this:
How can I populate the HTML table with this text file which changes everyday.
Also, is it possible to use php client-side only, without a server?
Yes and no. No, you can't run PHP locally and have it integrate with
pages served to your browser from somewhere else. Yes, you can install a
web server such as Apache on your local machine and have it serve pages
to you locally, integrating with PHP as desired. This is most likely what
I would do if my production server didn't have PHP (well, actually I
would get a different provider in that case); install Apache and PHP
locally, write a PHP script to read the file and generate the output,
upload static content to production server.
--
Alan Little
Phorm PHP Form Processor http://www.phorm.com/
"Malcolm Dew-Jones" <yf***@vtn1.vic toria.tc.ca> wrote in message
news:42******@n ews.victoria.tc .ca... alex (al************ **@hotmail.com) wrote: : Hi,
: I am looking for a way to populate an HTML table from an external : local text file which looks like this:
: DATE/TIME LAT. LON. DEPTH. ML. : -------------------- ---------- ---------- ------- ------- : 21/03/2005-04:06:03 XX,XX XX,XX 171 3,42 : 21/03/2005-12:23:53 XX,XX XX,XX 500 5,4 : 21/03/2005-12:43:10 XX,XX XX,XX 553 5,38 : 21/03/2005-18:47:51 XX,XX XX,XX 162 3,91 : 21/03/2005-19:29:49 XX,XX XX,XX 500 3,51 : 21/03/2005-20:04:51 XX,XX X,X 75 3,72
the absolutely easiest way is to simply wrap the above text with the <pre> </pre> tags.
I like Malcom's solution for its ease.
Or do you *need* the data in a table for some reason?
Perhaps to right-align numbers or hyperlink cells?
Also, I'm not familiar with Lat/Lon presented as "XX,XX";
Per http://jan.ucc.nau.edu/~cvm/latlongdist.html
Valid formats for Latitudes and Longitudes are:
option 1: dddmmssD or ddd mm'ss" D
where ddd = 1-3 digits for degrees, mm = 2 digits for minutes, ss = 2 digits
for seconds and D = N,S,E, or W. The seconds and special characters (spaces,
apostrophes, quotes) are all optional in this format. This leads to quite a
large number of possible valid formats.
option 2: ddd.ffffD
where ddd = 0-3 digits, ffff = 0-10 digits and D = N,S,E, or W. This format
represents a decimal number of degrees. If the number of degrees is a whole
number, the decimal point is optional.
option3: ddd mm.ffff'D
where ddd = 0-3 digits for degrees, mm = 2 digits for minutes, ffff = 0-10
digits for decimal portion of minutes and D = N,S,E, or W. This format
represents degrees and a decimal number of minutes.
alex wrote: Hi,
I am looking for a way to populate an HTML table from an external local text file which looks like this:
DATE/TIME LAT. LON. DEPTH. ML. -------------------- ---------- ---------- ------- ------- 21/03/2005-04:06:03 XX,XX XX,XX 171 3,42 21/03/2005-12:23:53 XX,XX XX,XX 500 5,4 21/03/2005-12:43:10 XX,XX XX,XX 553 5,38 21/03/2005-18:47:51 XX,XX XX,XX 162 3,91 21/03/2005-19:29:49 XX,XX XX,XX 500 3,51 21/03/2005-20:04:51 XX,XX X,X 75 3,72
The file could have more rows (DATA) that I show here. The file is provided to me on a daily basis and I have to update a web page daily with the contents of the file.
I considered using JavaScript embedded in the HTML page but I am a newbie on what scripting for the web it refers.
<div id="foo"><--INCLUDE FILE HERE--></div>
<script type="text/JavaScript">
onload= function(){
var d=document.getE lementById("foo ").innerHTML.sp lit(/\s+/)
document.getEle mentById("foo") .innerHTML=tabl e_maker(5,d);
}
function table_maker(col umns,array){
var txt="<TABLE cellpadding=1 cellspacing=1 border=1>"
var rows=Math.ceil( array.length/columns);
for(var r=0,t=0;r<rows; r++){
txt+="<TR>"
for(var c=0;c<columns;c ++){
txt+="<TD>"+arr ay[t++]+"</TD>"
}
txt+="</TR>"
}
txt+="</TR></TABLE>"
return txt;
}
</script>
Mick
"McKirahan" <Ne**@McKirahan .com> wrote in message news:<W7******* *************@c omcast.com>... "Malcolm Dew-Jones" <yf***@vtn1.vic toria.tc.ca> wrote in message news:42******@n ews.victoria.tc .ca... alex (al************ **@hotmail.com) wrote: : Hi,
: I am looking for a way to populate an HTML table from an external : local text file which looks like this:
: DATE/TIME LAT. LON. DEPTH. ML. : -------------------- ---------- ---------- ------- ------- : 21/03/2005-04:06:03 XX,XX XX,XX 171 3,42 : 21/03/2005-12:23:53 XX,XX XX,XX 500 5,4 : 21/03/2005-12:43:10 XX,XX XX,XX 553 5,38 : 21/03/2005-18:47:51 XX,XX XX,XX 162 3,91 : 21/03/2005-19:29:49 XX,XX XX,XX 500 3,51 : 21/03/2005-20:04:51 XX,XX X,X 75 3,72
Or do you *need* the data in a table for some reason?
Thanks for your answer, McKirahan. Just as a follow-up to some
questions...
I do need the data in a table in order to hyperlink some cells.
Also, I'm not familiar with Lat/Lon presented as "XX,XX";
Sorry, I only made a representation of Lat/Lon in order not to reveal
actual values of Lat/Lon that correspond to data in my organization.
The values for Lat/Lon given to me are according to option 2 below,
decimal number of degrees. Thanks for the good input. Per http://jan.ucc.nau.edu/~cvm/latlongdist.html
option 2: ddd.ffffD
where ddd = 0-3 digits, ffff = 0-10 digits and D = N,S,E, or W. This format represents a decimal number of degrees. If the number of degrees is a whole number, the decimal point is optional.
McKirahan wrote:
[...] Also, I'm not familiar with Lat/Lon presented as "XX,XX";
Per http://jan.ucc.nau.edu/~cvm/latlongdist.html
Valid formats for Latitudes and Longitudes are:
[...]
Whilst your reference to the Northern Arizona University may have
appropriate formats for the OP's purposes, the international standard
is ISO 6709:1983.
There are 2 main difference between ISO and your quoted source;
1. Hemispheres are denoted by "-" for W and S and "+" for E and N. I
suppose the mathematical symbols are more widely understood than
letters from the English alphabet.
2. The ISO formats are unambiguous.
A free version of the standard can be found here:
<URL:http://en.wikipedia.or g/wiki/ISO_6709>
Though to ensure full compliance (if required), a copy should be
purchased from ISO.
--
Rob
Mick White <mw***********@ rochester.rr.co m> wrote in message news:<b%******* *************@t wister.nyroc.rr .com>... alex wrote:
Hi,
I am looking for a way to populate an HTML table from an external local text file which looks like this:
DATE/TIME LAT. LON. DEPTH. ML. -------------------- ---------- ---------- ------- ------- 21/03/2005-04:06:03 XX,XX XX,XX 171 3,42 21/03/2005-12:23:53 XX,XX XX,XX 500 5,4 21/03/2005-12:43:10 XX,XX XX,XX 553 5,38 21/03/2005-18:47:51 XX,XX XX,XX 162 3,91 21/03/2005-19:29:49 XX,XX XX,XX 500 3,51 21/03/2005-20:04:51 XX,XX X,X 75 3,72
The file could have more rows (DATA) that I show here. The file is provided to me on a daily basis and I have to update a web page daily with the contents of the file.
I considered using JavaScript embedded in the HTML page but I am a newbie on what scripting for the web it refers. <div id="foo"><--INCLUDE FILE HERE--></div>
Forgive my ignorance, but, how do i include the file as dictated right
above?
Is there some kind of HTML statement that allows you to include an
external text file ? Please clarify as am a newbie on this. Thanks
Mick.
Alex.
<script type="text/JavaScript"> onload= function(){ var d=document.getE lementById("foo ").innerHTML.sp lit(/\s+/) document.getEle mentById("foo") .innerHTML=tabl e_maker(5,d); }
[...]
On 26 Mar 2005 21:13:39 -0800, in comp.lang.javas cript al************* *@hotmail.com (alex) wrote: | Hi, | | I am looking for a way to populate an HTML table from an external | local text file which looks like this: | | DATE/TIME LAT. LON. DEPTH. ML. | -------------------- ---------- ---------- ------- ------- | 21/03/2005-04:06:03 XX,XX XX,XX 171 3,42 | 21/03/2005-12:23:53 XX,XX XX,XX 500 5,4 | 21/03/2005-12:43:10 XX,XX XX,XX 553 5,38 | 21/03/2005-18:47:51 XX,XX XX,XX 162 3,91 | 21/03/2005-19:29:49 XX,XX XX,XX 500 3,51 | 21/03/2005-20:04:51 XX,XX X,X 75 3,72 | | The file could have more rows (DATA) that I show here. The file is | provided to me on a daily basis and I have to update a web page daily | with the contents of the file. | | I considered using JavaScript embedded in the HTML page but I am a | newbie on what scripting for the web it refers. | | How can I populate the HTML table with this text file which changes | everyday. | | Also, is it possible to use php client-side only, without a server? | | Your help, suggestions and feedback questions will be much | appreciated.
You could use javascript to open and read the file. If the user has
javascript disabled then they will see nothing.
Alternatively you could use an IFrame on your page to display your
file.
If the file extension is txt then browsers will display the text as it
appears in the file - no formatting.
If the file extension is csv then Internet Explorer will reformat the
text and display it in a limited Excel spreadsheet layout. Other
browsers (Firefox) will just show the text.
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dt d">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html;
charset=iso-8859-1" />
<title>Extern al text file</title>
</head>
<body>
<P>this is some text, menus etc</P>
<iframe src="pc-full.csv" width="100%" frameborder="1"
scrolling="auto " height="350px"> </iframe>
</body>
</html>
--------------------------------------------------------------- jn******@yourpa ntsyahoo.com.au : Remove your pants to reply
--------------------------------------------------------------- This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: alex |
last post by:
Hi,
I am looking for a way to populate an HTML table from an external
local text file which looks like this:
DATE/TIME LAT. LON. DEPTH. ML.
-------------------- ---------- ---------- ------- -------
21/03/2005-04:06:03 XX,XX XX,XX 171 3,42
21/03/2005-12:23:53 XX,XX XX,XX 500 5,4
21/03/2005-12:43:10 XX,XX XX,XX 553 5,38
|
by: Sharon |
last post by:
I have successfully loaded a DataSet object with a XML schema (XSD).
Now I wish to populate the tables that was created in the DataSet.
I have an XML file/string that contain all the needed data in the same
format as the XSD (the XML file/string was created using this same schema).
The XML file/string may contain data for a single table or for several
tables at once.
The question is:
|
by: Nithin |
last post by:
My code as an txt attachment.
I have 2 drop down list boxes that on selection populate text boxes
from my database table. I am able to display the correct values in
these text boxes.
I have 2 questions:
1) I would like the user update these text fields that get populated
with data from the database. For some reason I get the error when I
change the textbox value.
|
by: vj |
last post by:
How i can populate all fileds dynamically in jsp page based on contents
found in xml file?
I have written jsp servlets and java class file.
i transferred automatic data from jsp to servlet then to java class
which creates a xml file based on values entered in dynamic jsp page.
Now i want to read all those values entered to xml in my other jsp
page.
I am able to call values from file in my jsp page.
But as dynamic values can be any in no...
|
by: vijendra |
last post by:
How i can populate all fileds dynamically in jsp page based on contents
found in xml file?I have written jsp servlets and java class file.
i transferred automatic data from jsp to servlet then to java class
which creates a xml file based on values entered in dynamic jsp page.
Now i want to read all those values entered to xml in my other jsp
page.But as dynamic values can be any in no i don't know how could i
populate all those in my jsp...
| |
by: eureka |
last post by:
Hi All,
I'm training in Servlets, JSP and JavaScript,
I have a web page in which there's a "StudentName" textbox and
below it is a "Names" Dropdown list. Initially the Textbox is empty
and the Dropdown doesnt have any items..
The requirement is that as soon as one goes on typing the letters in
the StudentName-textbox the corresponding matching names have to appear
|
by: =?Utf-8?B?S2VzdGZpZWxk?= |
last post by:
Hi
Our company has a .Net web service that, when called via asp.net web pages
across our network works 100%! The problem is that when we try and call the
web service from a remote machine, one outside of our domain, we get the
error.. ** Client found response content type of 'text/html;
charset=Windows-1252', but expected 'text/xml' **. We can discover the web
service by typing in the url of the asmx so we know the server can 'see' it...
|
by: jcnone |
last post by:
Does anyone know how to populate form fields on a html web page (client
side) with data from an Excel file (CSV) or text file. I am currently having to
input data to many text fields manually. I would like to transfer the data into the
web form programatically from a CSV/text file. How can this be done? I am
new to javascript, but I will work through the challange if possible. Please help!
Thanks.
Jman
|
by: Sunny |
last post by:
Hi,
Can someone tell me, How to load the Body Html from a text file that
contains javascript.
to Manage my files I am creating an Index Page.
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8"/>
<title></title>
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
| |
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
| |
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |