#!/usr/pub/bin/python ############################################################### # # $Id: bye.py,v 1.1 1998/04/09 11:09:04 chenna Exp $ # # $Source: /home/chenna/py/RCS/bye.py,v $ # $Author: chenna $ # $Locker: $ # # This programs explains how to use the template module # # # # # import sys sys.path.append('/home/chenna/py') from template import * manuf = ['Adobe Systems','Berkley Systems','Compaq Computer', 'Coral Systems','Digital Equip Corp','IBM','Matrox Graphics'] manufHome = ['www.adobe.com','www.berksys.com','www.compaq.com', 'www.corel.com','www.digital.com','www.ibm.com', 'www.matrox.com'] items = ['Monitor','keyboard','CD-ROM Drive','Floppy Drive','mouse','ALL'] selected = 'IBM' t = template() t.TemplateInit('/home/chenna/py/sales.tmpl',None) t.TemplateSetPage('FirstPage') t.TemplatePrintFrom('Commit','voila','None') t.TemplatePrintFrom('select_start',' Choose Your Maker','prodName') for i in manuf: if i == selected: t.TemplatePrintFrom('Option',i,'SELECTED',i) else: t.TemplatePrintFrom('Option',i,'',i) t.TemplatePrintFrom('select_end','1') selected = 'monitor' t.TemplatePrintFrom('select_start',' Choose the device ','prodName') for i in items: if i == selected: t.TemplatePrintFrom('Option',i,'SELECTED',i) else: t.TemplatePrintFrom('Option',i,'',i) t.TemplatePrintFrom('select_end','2') t.TemplatePrintFrom('tableEnd') j=0 for i in manuf: t.TemplatePrintFrom('manufHome',manufHome[j],i) j = j + 1 t.TemplatePrintFrom('htmlTail') # # Assume you have already chosen through cgi interface # t.TemplateSetPage('secondPage') t.TemplatePrintFrom('htmlHead') j = 0 for i in items: t.TemplatePrintFrom('chosen',j+1,i,manufHome[j],manuf[j]) j = j + 1 t.TemplatePrintFrom('htmlTail')