How should I dynamically generate html tables?

Scrumpy reply at in_newsgroup.tks
Thu May 23 22:55:46 EDT 2002


I need help to generate a dynamically updated page on my free personal 
website ;-)

On the page in question, I list free & opensource software that I use. I 
use div elements to split up the page.

I have a lefthand div column which contains a software categories menu from 
which you can jump to the different categories of software on the page. In 
the righthand div column I list each piece of software in it's own table as 
follows (this is a simplified version):


<body>

# A site menu goes here.

<div id="leftcontent">
    	<p><b>Contents</b></p>
	<a href="#Email client">Email client</a><br>
	<a href="#Network tool">Network tools</a><br>
</div>

<div id="rightcontent">

<a name="Email client"></a>
<b>Email client</b><br>
<table>
# Each table is identical with cells containing pertinent info about each
# particular piece of software eg version, description, website link etc.
</table>

<a name="Network tool"></a>
<b>FIRST Network tool</b><br>
<table>
</table>

<a name="Network tool"></a>
<b>SECOND Network tool</b><br>
<table>
</table>

</div>

# A site menu goes here.

</body>


I keep the details of each piece of software in a CSV file and after I add 
or amend data I manually regenerate the above page and upload it to my 
website. I currently do this by merging the CSV file with a template of one 
of my "righcontent" div tables using MS Word's mail merge to catalog 
(single continuous page) feature. I then copy the resulting merged code and 
paste it into the above page, overwriting the 'old' contents of the 
"rightcontent" div.

In the future, I'd like to generate the whole html page automatically 
whenever data in the CSV file changes i.e. after I upload an updated CSV 
file to my website (alternatively, I could setup Apache etc. on my home PC, 
auto-generate the page and then upload it to my public website). That would 
mean tables would have to be automatically added, deleted or their contents 
modified.

Ideally I would also like to automatically generate an updated menu in the 
"leftcontent" div, which would save me time if a new software category is 
added (each record in the CSV file contains a software category and there 
can be more than one piece of software in each category).

Sometime in the future I may change to a paid webhost that provides MySQL 
access and use that instead of the CSV file ;-)

I'll use the above as a learning exercise as I've never previously 
programmed in Python. In this situation, do you think that I would be 
better off using Python or PHP? I've also never programmed in PHP! :)

I hope someone can point me to a webpage(s) with info. on how to go about 
doing this or make some helpful suggestions on where to go from here.

Looking forward to hearing from you.

Cheers,
Scrumpy :)



More information about the Python-list mailing list