Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 437
  • Last Modified:

HTML:Binding Data to a named file

I have the hdlist.txt indicated to create a table on this page, but only the headers display:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta name="description" content="Bits and PCs Specials" />
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Bits and PCs Specials</title>
</head>
<body>
<h1>Bits and PCs</h1>
<p>[<a href="index.htm" title="Bits and PCs home page">Home</a>]
[<a href="history/index.htm" title="Within these pages you'll find a history of personal computing as well as Bits and PC's own history">History Information</a>]
[<a href="specials.htm" title="Check out our advertised specials!">Advertised Specials</a>]
[<a href="products/index.htm" title="Find great deals on computers, monitors, accessories and more">Products</a>]
[<a href="services.htm" title="Let Bits and PC's take care of all your service needs.">Services</a>]</p>
<h3> Hard Drive Specials </h3>
<object id="hd" classid="clsid:333C7BC4-460F-11D0-BC04-0080C7055A83">
      <param name="DataURL" value="hdlist.txt">
      <param name="UseHeader" value="True">
</object>
<script type="text/javascript" language="JavaScript">
function priceClick() {
      hd.Sort="price";
      hd.Reset();
}

price.onclick=priceClick;

function capacityClick() {
      hd.Sort="capacity";
      hd.Reset();
}

capacity.onclick=capacityClick;

//-->
</script>

<table width="90%" border="4" cellpadding="2" cellspacing="5" id="hd" datasrc="hdlist.txt" bordercolorlight="996633" bordercolordark="#006600" align="center">
<thead>
<tr>
<td><strong><div id="cap">Capacity(GB)</div></strong></td>
<td><strong><div id="buffer">BufferSize(M)</div></strong></td>
<td><strong><div id="rp">RPM</div></strong></td>
<td><strong><div id="pri">Price</div></strong></td>
</tr>
</thead>
<tbody>
<tr>
<td><div datafld="cap"></div></td>
<td><div datafld="buffer"></div></td>
<td><div datafld="rp"></div></td>
<td><div datafld="pric"></div></td>
<tr>
</tbody>
</body>
<div>For information about sales, service or store hours contact <a href="mailto:SG@bPCs.com">SG@bPCs.com</a></div>



</body>
</html> 

Open in new window

0
gamblsj
Asked:
gamblsj
  • 13
  • 9
1 Solution
 
aikimarkCommented:
I think you need to change the datasrc value to refer to your object as shown below.

I'm a bit concerned that both the object and the table have identical ID values
<table width="90%" border="4" cellpadding="2" cellspacing="5" id="hd" datasrc="#hd" bordercolorlight="996633" bordercolordark="#006600" align="center">

Open in new window

0
 
gamblsjAuthor Commented:
Here is the output:

Bits and PCs

[Home] [History Information] [Advertised Specials] [Products] [Services]

Hard Drive Specials

For information about sales, service or store hours contact SG@bPC.com

Capacity(GB) BufferSize(M) RPM Price
      

The bottom line should be a table that is populated by the file hdlist.txt, and the line that begins "For information...should be on the bottom.
      
      
0
 
aikimarkCommented:
@gamblsj

Did you change your HTML per my earlier comment?

What is the format of the text file?
0
Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

 
gamblsjAuthor Commented:
Yes I changed the HTML, and the file is a .txt file.
0
 
aikimarkCommented:
Is it a delimited file?  If so, what is the delimiter?
0
 
gamblsjAuthor Commented:
Excuse my ignorance, but what is a delimited file?
0
 
aikimarkCommented:
A "delimited file" is a data format where the data values (and, optionally headers) are separated by one or more characters.  Most common delimiters are comma and tab.  You will frequently see the CSV file type used for comma-separated-variable (delimited) files.
0
 
gamblsjAuthor Commented:
Sorry, the delimiter is a comma.
0
 
aikimarkCommented:
Does it work if you rename the file hdlist.csv ?
0
 
aikimarkCommented:
I suspect you will need to add the following <param> tag to your object in order to process a comma-delimited file with a txt file type.
<PARAM NAME="FieldDelim" VALUE=",">

Open in new window

0
 
gamblsjAuthor Commented:
Still not working...
0
 
aikimarkCommented:
please post your HTML and upload the hdlist.txt file (after removing/obscuring contact information).
0
 
gamblsjAuthor Commented:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta name="description" content="Bits and PCs Specials" />
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Bits and PCs Specials</title>
</head>
<body>
<h1>Bits and PCs</h1>
<p>[<a href="index.htm" title="Bits and PCs home page">Home</a>]
[<a href="history/index.htm" title="Within these pages you'll find a history of personal computing as well as Bits and PC's own history">History Information</a>]
[<a href="specials.htm" title="Check out our advertised specials!">Advertised Specials</a>]
[<a href="products/index.htm" title="Find great deals on computers, monitors, accessories and more">Products</a>]
[<a href="services.htm" title="Let Bits and PC's take care of all your service needs.">Services</a>]</p>
<h3> Hard Drive Specials </h3>
<object id="hd" classid="clsid:333C7BC4-460F-11D0-BC04-0080C7055A83">
      <param name="DataURL" value="hdlist.txt">
      <param name="UseHeader" value="True">
	  <param name="FieldDelim" VALUE=",">
</object>
<script type="text/javascript" language="JavaScript">
function priceClick() {
      hd.Sort="price";
      hd.Reset();
}

price.onclick=priceClick;

function capacityClick() {
      hd.Sort="capacity";
      hd.Reset();
}

capacity.onclick=capacityClick;

//-->
</script>

<table width="90%" border="4" cellpadding="2" cellspacing="5" id="hd" datasrc="#hd" bordercolorlight="996633" bordercolordark="#006600" align="center">
<thead>
<tr>
<td><strong><div id="cap">Capacity(GB)</div></strong></td>
<td><strong><div id="buffer">BufferSize(M)</div></strong></td>
<td><strong><div id="rp">RPM</div></strong></td>
<td><strong><div id="pri">Price</div></strong></td>
</tr>
</thead>
<tbody>
<tr>
<td><div datafld="cap"></div></td>
<td><div datafld="buffer"></div></td>
<td><div datafld="rp"></div></td>
<td><div datafld="pric"></div></td>
<tr>
</tbody>
</body>
<div>For information about sales, service or store hours contact <a href="mailto@bPC.com">@bPC.com</a></div>



</body>
</html>

Open in new window

0
 
aikimarkCommented:
change the ID for the table tag so that you aren't getting a conflict.

What about the text file?
<table width="90%" border="4" cellpadding="2" cellspacing="5" id="tblhd" datasrc="#hd" bordercolorlight="996633" bordercolordark="#006600" align="center">

Open in new window

0
 
gamblsjAuthor Commented:
Here is the text of the file:

capacity,size(M),rpm,price
160,8,7200,$110.99
250,8,7200,$130.99
300,16,7200,$145.99
100,8,7200,$100.99
450,16,7200,$150.00
255,8,7200,$120.99
0
 
aikimarkCommented:
did you change the table ID and reload the page?
0
 
gamblsjAuthor Commented:
Yes
0
 
aikimarkCommented:
I fixed two things:
1. there was no </table> tag
2. Your datafld tags did not have the correct field/column names - not matched by the header row values in the text file
capacity,size(M),rpm,price

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta name="description" content="Bits and PCs Specials" />
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Bits and PCs Specials</title>
</head>
<body>
<h1>Bits and PCs</h1>
<p>[<a href="index.htm" title="Bits and PCs home page">Home</a>]
[<a href="history/index.htm" title="Within these pages you'll find a history of personal computing as well as Bits and PC's own history">History Information</a>]
[<a href="specials.htm" title="Check out our advertised specials!">Advertised Specials</a>]
[<a href="products/index.htm" title="Find great deals on computers, monitors, accessories and more">Products</a>]
[<a href="services.htm" title="Let Bits and PC's take care of all your service needs.">Services</a>]</p>
<h3> Hard Drive Specials </h3>
<object id="hd" classid="clsid:333C7BC4-460F-11D0-BC04-0080C7055A83">
      <param name="DataURL" value="hdlist.txt">
      <param name="UseHeader" value="True">
      <param name="FieldDelim" value=",">
</object>
<script type="text/javascript" language="JavaScript">
function priceClick() {
      hd.Sort="price";
      hd.Reset();
}

price.onclick=priceClick;

function capacityClick() {
      hd.Sort="capacity";
      hd.Reset();
}

capacity.onclick=capacityClick;

//-->
</script>

<table width="90%" border="4" cellpadding="2" cellspacing="5" id="tblhd" datasrc="#hd" bordercolorlight="996633" bordercolordark="#006600" align="center">
<thead>
<tr>
<td><strong><div id="cap">Capacity(GB)</div></strong></td>
<td><strong><div id="buffer">BufferSize(M)</div></strong></td>
<td><strong><div id="rp">RPM</div></strong></td>
<td><strong><div id="pri">Price</div></strong></td>
</tr>
</thead>
<tbody>
<tr>
<td><div datafld="capacity"></div></td>
<td><div datafld="size(M)"></div></td>
<td><div datafld="rpm"></div></td>
<td><div datafld="price"></div></td>
<tr>
</tbody>
</table>
</body>
<div>For information about sales, service or store hours contact <a href="mailto@bPC.com">@bPC.com</a></div>



</body>
</html>

Open in new window

0
 
aikimarkCommented:
@gamblsj

Did this answer your question?
0
 
aikimarkCommented:
@gamblsj

Are you ok?  Please post a comment.
0
 
gamblsjAuthor Commented:
Thanks for the assistance. I am working on the next phase and may need some help. Talk to you soon!
0
 
aikimarkCommented:
@gamblsj

When you are ready, click on the Ask A Related Question link.
0

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

  • 13
  • 9
Tackle projects and never again get stuck behind a technical roadblock.
Join Now