Web Connect How To : Show Me the Code!

 LAFOX Home How URL Maps to Code  LAFOX Design Oveview  Framework Extensions 
*Relatedsites.prg #INCLUDE WCONNECT.H ************************************************************* DEFINE CLASS RelatedSites AS rbPage ************************************************************* ************************************************************** ** Page() - PUBLIC - ** Web Hit - only - just read the URL and call a Fox Function ************************************************************** FUNCTION Page PRIVATE pcContent, pcPageTitle pcPageTitle = "Links Page" ** Prepare Data This.Data() ** Create the HTML Table This.Content = [<!-- Site.DataPath = ]+Site.DataPath+[-->]+; This.TableHeader()+This.HTMLTable() ** Show the page This.Merge('TemplatePage.htm') ENDFUNC && Page() ****************************************************************** ** Helper functions below ****************************************************************** ************************************************************** ** Data() - Hidden - ** Open the tables, set order, filters, etc. ************************************************************** HIDDEN FUNCTION Data ** SQL the data into cursor tList from URL.dbf ** include site name and description ** include <a href in site name - (Make SiteName a link) SELECT PADR([<a href="]+ALLTRIM(URL)+[">]+ ; STRTRAN(STRTRAN(ALLTRIM(URL),[HTTP://],[]),[WWW.],[]) ; +[</a>],240) as ALLTRIMURL, SiteName, Descript ; FROM (Site.DataPath + "URL.dbf") ; WHERE approved ; ORDER BY SiteName ; INTO CURSOR tList ENDFUNC &&Data() ************************************************************** ** HTMLTable() - Hidden - ** Make an HTML Table of the links ************************************************************** HIDDEN FUNCTION HTMLTable() ** Use Rick's wwShowCursor LOCAL ARRAY laHeaders(1) DIMENSION laHeaders[3] laHeaders[1] = "URL" laHeaders[2] = "Site" laHeaders[3] = "Description" loSC = CREATEOBJECT("wwShowCursor") loSC.BuildFieldListHeader(@laHeaders) loSC.lAlternateRows = .T. && Alternate row colors loSC.cAlternatingBGColor =["#DFEEFF"] loSC.cTableBGColor =["#FFFFFF"] loSC.cPage_PageURL = [/RelatedSites.Page.fox?SessionID=_6ZL1BE9ZX&] loSC.cTableBorder = [1] loSC.nPage_ItemsPerPage = 20 loSC.ShowCursor() *** This writes grabs and writes the output from ShowCursor Return loSC.GetOutput() ENDFUNC &&HTMLTable() HIDDEN Function TableHeader() RETURN [<p align="center"><b>]+Site.SiteName+[ Related Sites</b></p>] ENDFUNC &&& TableHeader ENDDEFINE && RelatedSites
csCodeParser v0.9 stats: 76 lines in 0.00 seconds.