On this page [URL=”http://www.ihatemyfurnace.com/goodman.html”]http://www.ihatemyfurnace.com/goodman.html
I’m using switch and case to match up parts with a model number. This thing is getting looong and I’m not even halfway done yet.
Can I keep doing it this way without affecting the loading time? Or is there a completely better way to do it all? Maybe a way that would save me from typing so much? Right now I’m doing copy/paste and just changing part numbers and prices. I’m thinking that a database might be the answer, but I have no experience with those at all.
Thanks to anyone with some good advice, I appreciate ANY comments good or bad. I learn better that way. ?
[CODE]
<furnace model="gmp1254">
<hilimit>
<model>1370912s</model>
<price>24.66</price>
</hilimit>
<venter>
<model>b1859005</model>
<price>192.98</price>
</venter>
<fsensor>
<model>b1172606</model>
<price>7.19</price>
</fsensor>
<!--...etc and so on for each attribute...-->
</furnace>
[/CODE]
<i>
</i>function pdfDoc() {
manual = document.askModel.model.value;
manual = manual.replace(/[^a-zA-Z 0-9]+/g,'');
manual = manual.toLowerCase();
// this is your first dimension javascript object
var manual_data = {
gmp0503: // new, second dimension object
{
hilimit : "1370912s",
venter : "b1859005",
fsensor : "b1172606",
igniter : "b1401009s",
rollout : "b1370154",
burner : "2522703s"
// etc.
},
gmp0753: { // another second dimension object
hilimit : "1370912s",
venter : "b1859005",
fsensor : "b1172606",
igniter : "b1401009s",
rollout : "b1370154",
burner : "2522703s"
// etc.
}
};
<i>
</i>// if "manual" is "gmp0503," then the below will alert "1370912s"
alert (manual_data[manual].hilimit);
I initially had thought about proposing something similar to what Jona proposed above but I decided against it for the reason that it does not alleviate the problem of having to load ALL the data for ALL the furnaces and their parts whenever somebody hits the page regardless of whether or not they are even going to look at any of it. Chances are they are going to request the data for maybe one or two of the possible furnaces at most so by loading all that other data every time you're just wasting bandwidth and slowing down the performance needlessly. I feel the best approach would be a hybrid of his suggestion and my own. Use my approach to limit loading only the furnace data you need on demand. Use his approach to store the data in the javascript engine memory for a given furnace once the data for that given furnace has been parsed from its corresponding data xml (or text) file.[/QUOTE]
As the page holds about 75 records, and each record is just a little text, I wouldn't be too concerned with storage-methods. If the webserver is serving these pages raw, not compressed with g-zip, we are talking about a total size of 49 K, and since everything is done on-page with javascript, the page loads only once per "use".
If this page does what you need it to do, then let it be. As you have no experience with Ajax, PHP or database development, and this page is all you need it for, and you don't wish to spend some time learning that part, don't worry. Your page works.
[/QUOTE]
- Spinner
Question: Is learning database creation/operation really all that difficult?[/QUOTE]
If the furnace makers held all the info on their own sites in a sensible format, then you could use YQL to pull the data in and not worry about maintaining it yourself.?[/QUOTE]
0.1.9 — BETA 5.18