Is it possible to get a script that can ‘mirror’ or copy file content from a database to a web page?
For example, I want to develop a database in MS Access 2000. I will call my database, ‘test.mdb’. In this database I am to create a table called, ‘documents’. In this table I want to insert all my word documents and pdf files. I am not sure if this is a job for MS 2000, maybe SQL database is better?
Anyway, I am looking for a script that can call the content from this database/table. Perhaps - VBScripting or maybe Java Scripting can do this? In fact, any script would do, as long as I can retrieve the content in my database and display it on an html page. It that possible or is there a different way to achieve this?
The idea is to have a several hyperlinks on my web page (overview.html), which point to different documents in my database. Once clicking on the hyperlink, the content is displayed. In other words, I am trying to get a script developed that can ‘mirror’ the content of a document and transferred/display it on my web page, called ‘overview.html’. I am also aiming to use a similar script for images (.gif and .jpg files) – this way I only need to change content in the database and the web takes care of the rest.
Generating web table from db table with biterscripting
I would need the exact structure of db table to write the code. But, here, I will provide an example using csv (comma separated values).
I will assume that a db table has been exported to "table1.csv" file in csv format. The web page template is at "template.html". It has a marker "INSERT_TABLE1_HERE" where the rows and columns of table1 need to go. Here is the code.
# Read table1.csv into $table.
var str table ; cat "table1.csv" > $table
# Create $web_table from $table.
var str $web_table ; echo "<table>" >> $web_table
# Extract rows and columns from $table,
# insert into $web_table with <tr> and <td>.
while ($table <> "")
echo "\n<tr>" >> $web_table
var str row ; lex -e "1" $table > $row
while ($row <> "")
var str column ; lex -e "1" $row > $column
echo "<td>" $column "</td>"
# We are done with the row.
echo "</tr>" >> $web_table
# We are done with the table.
echo "</table>" >> $web_table
# Replace "INSERT_TABLE1_HERE" in template.html with $web_table.
var strhtml ; cat "template.html" > $html
sal "^INSERT_TABLE1_HERE^" $web_table $html ; echo $html > "template.html"