Is it possible?

I have a table setup which imports an image into one cell, and need to import text to the cell to the right of the image.

Importing the image from my PC is no problem (img src="images\image1.jpg" within the <td>), but I can't do the same with the text. Can it be done from a local file, (src="textfiles\text1.txt" or something like that) or will it only work using a URL to a file stored on a server?

I need to find something better than the eCommerce catalog system in Netobjects Fusion 11, and even the tables in fusion aren't really upto the job in hand. I hope to hand-code my own tables and patch the code into my website.

Dani AI

Generated

Quick practical ways to stop hand‑editing 102 product descriptions — building on ’s hint and ’s CSV situation.

One-time build step (recommended)
Create a small script that reads each CSV, normalises fields (sku, title, description, bullets), and emits either single HTML fragments (one file per product) or a single JSON file the site consumes. That makes the site static at runtime (fast, simple) and removes the Word step entirely. Tools: a short Node/Python script or a static site generator; store descriptions as plain text or Markdown and convert to HTML during the build.

Client-side / local editing workflow
For local editing or testing before upload, use the browser FileReader + a CSV parser to turn CSV rows into DOM content so you can preview and finish formatting without Word. Use textContent (or a sanitizer) when inserting values to avoid accidental markup execution. PapaParse is a solid CSV parser: PapaParse.

Example (very small) — read a CSV file, parse it, inject a product description safely:

document.querySelector('#csvfile').addEventListener('change', function(e){
  var fr = new FileReader();
  fr.onload = function(ev){
    var rows = Papa.parse(ev.target.result, {header:true}).data;
    var row = rows.find(r => r.sku === 'SKU123');
    if(row) document.getElementById('desc-SKU123').textContent = row.description;
  };
  fr.readAsText(e.target.files[0]);
});

Auto-updating stock from suppliers
Do the RSS polling on the server (cron or scheduled job). The server parses the supplier feed, updates a DB or writes a cached JSON endpoint, and your pages fetch that endpoint. Client-side fetches of supplier RSS often fail because of CORS and reliability; server polling avoids that and lets you control caching, rate limits and validation.

Quick tips: avoid pasting Word HTML into CSVs; use forward slashes in URL paths; store plain text/Markdown in source files; sanitise HTML on output to prevent XSS.

Recommended Answers

All 3 Replies

Not sure I am following you. Are you wanting to ad text to a cell in a table, if so cant you just copy and paste in your code? Where is this text coming from?

All files need to be saved on the server (be the server your desktop or a remote host). When you add images to your site using <img src="">, the browser is asking your server (be it IIS or apache) via a url and the server sends the response (the image). You can serve up text the same way by various means but you cannot directly read those files via javascript. You could show the files the same way you do images by using an iFrame such <iframe src='textfiles/text1.txt'></iframe>. But you would need to provide formating for those files in the same manner as you would an html file. You could also use a serverside language such as C#, java, php, or perl, read in the files and print them out like you would your html. There are quite a few ways to do it.

Scrappedcola, you hit it on the head with the <iFrame>.

My problem has been that I have 102 products, with detailed descriptions for each in seperate CSV files. Up to now, I had to use Word to read each file, change the font to Georgia 10px, format with bullet points and then change the font color before copy/pasting it in to the tables. Any change to the product specs means going through it all again.

Now, I can read in the CSV files on my own PC, finish developing the site and finally upload the HTML & CSV files to the server and let it take care of it's own maintenance.

Man, life was so much easier when I worked as a COBOL programmer.

Next problem, getting Fusion 11 to read an RSS feed from my suppliers to auto-update stock levels .........

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.