Subject Re: Copying text...
From Mervyn Bick <invalid@invalid.invalid>
Date Wed, 22 Jun 2016 16:53:17 +0200
Newsgroups dbase.getting-started
Attachment(s) MAKE_HTML_PRICELIST.prg

On 21/06/2016 15:36, Charlie wrote:
> Hi Mervyn,
>
> Believe it or not since I had some problems with oodml, I actually have this running in xdml.  I used a simple loop and now it works great.  The loop takes around 20 seconds which is a little longer than your version.  I got almost all of the Lionel done and everything else except for Marx done yesterday.
>
> I should be able to figure out the font and other html detail soon.
>
> So what this program that you have introduced me to has done.  It used to take me at least an hour per page.  Now it will take me less than fifteen minutes to do everything once the data is organized.
>
> I will at some point try to get this into oodml as I know that is what it is intended for.

I've been digging a bit deeper into creating web pages using HTML and
I've now learnt a bit more on managing values displayed in tables.  (One
CAN teach an old dog new tricks. :-) )

A revised make_html_pricelist.prg is attached.

Mixed case text is easier to read than all upper case so I've used
proper() to format the text in the table.  If you don't want this then
simply set lMixedCase = false at the top of the program.  Be aware
though that using all upper case lowers the maximum font size that you
can use.

Other variables allow you to set the width of the table, the width of
individual columns, font and font size.   Making the table narrower will
also place a lower limit on the font size that can be used.

Mervyn.






function make_html_pricelist(cFile,cListname,cTable)
   nEndYear = 1900 // year(date())-5 // Change value here to limit entried to a specified number of years
   cGendate = dtoc(date())
  
   //Set pricelist table options here
   nTableW = 90   // % of html page width
   nRowH = 14   //height of table row.  Values less then font size have no effect.
   nCol1W = 55  //percent table width for Description
   nCol2W = 27  //percent table width for Grade
   nCol3W = 8   //percent table width for Year
   nCol4W = 8   //percent table width for Price
   // Column width values must total 100
   cFont = "Arial,Helvitica"
   nFontSize = 14   //font size must be not more then 14 if lMixedCase is set fasle
  
   lMixedCase = true    //set false for all uppercase

   f = new file()
   f.create(cFile)
   f.puts('<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">')
   f.puts([<HTML>])
   f.puts([<head>])
   f.puts([<title>Free Electric Train Price Guide</title>])
   f.puts([<meta name="description" content="Electric Train Price Guide">])
   f.puts([<meta name="keywords" content="price guide, electric train price guide, train price book, trains, electric, tinplate, toy train set, miniature railroad, pre war, american flyer pre war, american flyer o gauge, american flyer 3 rail, american flyer o scale, O-27,k-line">])
   f.puts([<meta name="rating" content="general">])
   f.puts([<meta name="revisit-after" content="31 Days">])
   f.puts([<meta name="expires" content="never">])
   f.puts([<meta name="distribution" content="global">])
   f.puts([<meta name="choochooauctions.com" content="index,follow">])
   f.puts([<style type = "text/css">])
   f.puts([<!--])
   f.puts([.tablelayout{width: ]+nTableW+[%;border="0"; cellpadding="0" ;cellspacing="0";}])
   f.puts([-->])
   f.puts([</style>])
   f.puts([<style type = "text/css">])
   f.puts([<!--])  
   f.puts([.text1{font-family: ]+cFont+[; font-size: ]+nFontsize+[;text-align: left;width = ]+nCol1W+[%;}])
   f.puts([-->])
   f.puts([</style>])
   f.puts([<style type = "text/css">])
   f.puts([<!--])
   f.puts([.text2{font-family: ]+cFont+[; font-size: ]+nFontsize+[;text-align: left;width = ]+nCol2W+[%;}])
   f.puts([-->])
   f.puts([</style>])
   f.puts([<style type = "text/css">])
   f.puts([<!--])
   f.puts([.text3{font-family: ]+cFont+[; font-size: ]+nFontsize+[;text-align: left;width = ]+nCol3W+[%;}])
   f.puts([-->])
   f.puts([</style>])
   f.puts([<style type = "text/css">])
   f.puts([<!--])
   f.puts([.text4{font-family: ]+cFont+[; font-size: ]+nFontsize+[;text-align: right;width = ]+nCol4W+[%;}])
   f.puts([-->])
   f.puts([</style>])
   f.puts([</head>])
   f.puts([])
   f.puts([<BODY BGCOLOR="#000080" TEXT="#000000" ALINK="#000000" VLINK="#0033ff" LINK="#0033ff">])
   f.puts([])
   f.puts([<TABLE HEIGHT="80%" BORDER="0" align= center bgcolor = "#ffffff" cellpadding = "10">])
   f.puts([<TR>])
   f.puts([        <TD ALIGN="LEFT" VALIGN="TOP" WIDTH="600" align=center>])
   f.puts([<table align="center" border="0" width="95%">])
   f.puts([<tr>])
   f.puts([<td width="1220">])
   f.puts([<p><A HREF="http://www.choochooauctions.com" target = "_new"><IMG SRC="http://www.choochooauctions.com/images/choo.gif" BORDER="0"alt="choochooauctions.com"></A></p>])
   f.puts([])
   f.puts([</td>])
   f.puts([<td width = "100%" align = "right" nowrap><A HREF="http://www.traincity.com/shopbuy.html" TARGET="_new"><img SRC="http://www.choochooauctions.com/images/buy.jpg" ALIGN="right" valign = "center" BORDER = "1" alt=" Click here if you have trains for sale!"</a></td>])
   f.puts([])
   f.puts([</table>])
   f.puts([<BR>])
   f.puts([<CENTER><HR WIDTH="400" SIZE="3"><P>])
   f.puts([<b>  <font face="Arial,Helvetica" SIZE="5">Free Electric Train Price Guide<BR></font></b>])
   f.puts([<FONT FACE="Arial" SIZE="1">(To print:  Right click on list, then click print in the pop-up menu.)<P></FONT></center>])
   f.puts([<FONT FACE="Arial" SIZE="2">Items shown on this list are not for sale.  This is a price guide generated from our database based on past sales history.  Items appearing in this guide have been sold and are no longer in our inventory.  To view our current inventory please check out <A HREF="http://www.choochooauctions.com" TARGET="_new">choochooauctions.com</A> or <A HREF="http://www.traincity.com" TARGET="_new">traincity.com</A>.  Thanks for using our guides.<P></FONT>])
   f.puts([])
   f.puts([<FONT FACE="Arial" SIZE="3">])
   f.puts([<center>This free <A HREF="http://www.traincity.com/price_guide/read.html">electric train Price Guide</A> brought to you by:<BR>])
   f.puts([<A HREF="http://www.choochooauctions.com" TARGET="_new"><B>choochooauctions.com</B></A> and <A HREF="http://www.traincity.com" TARGET="_new"><B>traincity.com</B></A>])
   f.puts([</font>])
   f.puts([<p>])
   f.puts([<FONT FACE="Arial" SIZE="-8">])
   f.puts([<table  cellpadding=3 border = "1" width = "50%">])
   f.puts([<td align=center><FONT FACE="Arial">]+cListName+[</FONT></A></td>])
   f.puts([<td align=center><FONT FACE="Arial">Generated ]+cGendate+[</FONT></td>])
   f.puts([<tr>])
   f.puts([])
   f.puts([</font>])
   f.puts([])
   f.puts([</TD>])
   f.puts([</TABLE>])
   ******************* Build pricelist ***************
  
   q = new query()
   q.sql = 'select title,;
     grade,;
     yr ,;
     asell1 from "'+cTable+'"  ;
     where yr > '+nEndYear
   q.active = true
   f.puts([<center>])
   f.puts([<table class="tablelayout">])
   f.puts([<tbody>])
   f.puts([<tr height = "]+nRowH+[">])
   f.puts([<th class="text1">Description</th>])
   f.puts([<th class="text2">Grade</th>])
   f.puts([<th class="text3">Year</th>])
   f.puts([<th class="text4">Price</th>])
   f.puts([</tr>])

   do while not q.rowset.endofset    
      f.puts([<tr height = "]+nRowH+[">])
      if lMixedcase = true
         f.puts([<td class="text1">]+proper(q.rowset.fields["title"].value)+[</td>])
         f.puts([<td class="text2">]+proper(q.rowset.fields["grade"].value)+[</td>])
      else
         f.puts([<td class="text1">]+q.rowset.fields["title"].value+[</td>])
         f.puts([<td class="text2">]+q.rowset.fields["grade"].value+[</td>])      
      endif
      f.puts([<td class="text3">]+q.rowset.fields["yr"].value+[</td>])
      f.puts([<td class="text4">]+q.rowset.fields["asell1"].value+[</td>])
      f.puts([</tr>])
      q.rowset.next()
   enddo
   f.puts([</tbody>])
   f.puts([</table>])
   f.puts([</centre>])
//  f.puts([</font>])
   q.active = false
   ***************** End of pricelist *********************
   f.puts([])
   f.puts([</CENTER>])
   f.puts([<P>])
   f.puts([<CENTER><FONT FACE="arial" SIZE="-1">])
   f.puts([<table border ="0" width = "100%" cellpadding ="3">])
   f.puts([<td  align=center>])
   f.puts([<FONT FACE="arial" SIZE="2">])
   f.puts([<A HREF="index.html"><B>Home</B></A>&nbsp;|&nbsp;<A HREF="read.html"><B>About this guide</B></A>&nbsp;|&nbsp;<A HREF="http://www.choochooauctions.com"><B>Visit choochooauctions.com</B></A>&nbsp;|&nbsp;<A HREF="http://www.traincity.com"><B>Visit traincity.com</B></A>&nbsp;|&nbsp;<A HREF="mailto:trainman@traincity.com"><B>Contact Us</B></a>])
   f.puts([</font>])
   f.puts([</td>])
   f.puts([</table>])
   f.puts([<table border ="0" width = "60%"  cellpadding ="3">])
   f.puts([<td  align=center width="100%">])
   f.puts([<FONT FACE="arial" SIZE="2">])
   f.puts([<CENTER>All rights reserved.  choochooauctions.com</CENTER>])
   f.puts([</font>])
   f.puts([</td>])
   f.puts([</table>])
   f.puts([<P>])
   f.puts([<CENTER>])
   f.puts([<A HREF="http://www.choochooauctions.com/" target = "_new">])
   f.puts([<IMG SRC="http://www.traincity.com/banner/choochoo_468x60_animated_low_13k.gif" BORDER="1" alt="Visit Choochooauctions.com"></A>])
   f.puts([</CENTER>])
   f.puts([</table>])
   f.puts([</FONT></CENTER>])
   f.puts([])
   f.puts([</TABLE>])
   f.puts([</HTML>])
   f.puts([</BODY>])
   f.close()
   return true