The contents of two databases on the output HTML format methods
Abstract: vfp in the preparation of the practical application of the various types of applications, the users created a large amount of information is generally stored in the application of the system database. With the rapid development of network technology, many information-sharing requires the use of the Internet, such as the application of the system information database already exists, the output of the document to HTML format for online browsing, can solve the problem of data sharing, this paper introduces use conversion FrontPage2000 with VFP class library and programming the contents of two databases can be converted to HTML format documents.
VFP in the practical application of the process of the preparation of various types of applications, users may set up a large amount of data information are generally stored in various types of data tables, with the rapid development of network technology, many online information request a total of enjoy the use of relevant information if the data table already exists, you can do not need to re-enter the information generated can be directly used in the Internet browser HTML format, the author introduced the following two types of database content to HTML format for the output method.
First, is the use of VFP data tables provided by the contents of the conversion to HTML format library to achieve. The purpose of the VFP system under the FFC subdirectory _internet.vcx there is a class library, including data tables for _dbf2html to HTML format conversion type, in use, the window controls in the form used method to add class to add the class library to control, and add in the form _dbf2html categories, such related properties, events and methods are described below:
cSource attributes that the data table to generate HTML source file name, default value is "."
_GENHTML Attributes NgenOutput output options
0 - to generate output file
1 - to generate the output file and in the Visual foxpro editor show that it
2 - generated output file and the editor in Internet Explorer to display it
3 - in the show after the Save As dialog box and display the output file generated
4 - the establishment of targets and generate PUBLIC_oHTML a file
5 - the establishment of PUBLIC_oHTML object does not generate a file
Default value of 2
cOutFile attributes that the HTML output file name, default value is ""
IautoNameOutput attributes automatically _GENHTML pointed out to the command based on the source of the output file, default values
IuseCurrentAlias attributes indicate whether the current use of an alias as the source for default values. T..
Cscope the scope of property that the output (eg good NEXT, or ALL), the default value of "."
Genhtml.dbf attributes CStyle pointed out that the ID field lists the visual style, the default value of "."
GenHTML methods through the use of Csource, cOutpur and attributes specified in nGenOutput call
Genhtml.prg to generate HTML code
Syntax: GenHTML ()
Return value: None
If the disk in case there is a cadre of basic data table, we can use the above described library staff communication was recorded automatically in the production of the data page format.
Create a new form, in the form type to use to add form controls _internet.vcx library, click Add to _dbf2html type of form, the type of NAME attribute set to ZH, other attributes are the default values, and then in the form add a command button COMMAND1, in the order of the CLICK button to add the following event code:
FILE1 = GETFILE ( "DBF") & & select a data table file
FILE2 = SUBS (FILE1, 1, AT (".", FILE1) -1) & & remove the file name suffix
FILE2 = SUBS (FILE2, RAT ( "", FILE2) +1) & & remove the file name path
IF USED ( "& FILE2")
SELE & FILE2
USE & FILE2
& & The above command is to identify a data file has been opened
THISFORM.ZH.GENHTML () & & the implementation of the conversion process
Save and run the form, use the mouse to click the command button window will pop up a dialog box select the file, here is free to select a data table file, we have chosen is recorded communications personnel data sheets, will be found to determine, The system will automatically generate a data table chosen to HTM document of the same name as the file extension of the page and start the browser the generated HTM file, a database of the contents of the output HTML document.
Second, application FrontPage2000 website editing tools and VFP system to achieve a combination of programming skills, the former a way to generate the HTML format of the form is based on the form, a record of each act, when the contents of database fields too, browse to generate The HTML format is very inconvenient. In practice, a person often needs to be the case of a self-generate the HTML table style format, using the method provided above can not be achieved by. Application can take FrontPage2000 page editing tools with the VFP system a combination of programming skills, and diverse ways to generate the output pages of documents requested.
FrontPage2000 the first to use editing tool, a WYSIWYG editor for static pages, the final edit of the web page below:
Designer on this page, the generated table in front of # # characters with which to generate the page format for the data source field name in the database, such as # # name, which the name of the database field name. View HTML source file, we have all the source files to choose, and then copy operation.
Create a new page format for storing the contents of the database, the Treasury named LSK.DBF, the database is only one field named HTMLNR, Remarks type. To add a space for the database record, and then open the Notes field to enter the edit window HTMLNR state, and then paste the implementation of the operational FrontPage2000 generated pages in the format of the contents of all source files are copied to the Notes field, such a well-designed web page format library on the generated here can also generate a large number of different Web content storage format to the database for use at any time to generate the page, here we are in a style as an example.
The preparation of a section of the conversion process, the program's main working principle LSK to open the database, retrieve the format string to generate the page content, to open the cadres need to output the contents of the basic situation of database files, use the database to replace the contents of the corresponding field in the page format # # for the ID string of the contents of the field, replace the contents of all fields completed, the final text of the format to generate a HTML document, you can complete the whole system requirements, the preparation of the procedures are as follows:
USE LSK & & Open the page format of the contents of the Treasury
ZYNR = HTMLNR & & out the contents of the text of a web page format
USE RYK & & Open the need to generate web database
ZYNR = STRTRAN (ZYNR, "# # name", RYK. Name)
ZYNR = STRTRAN (ZYNR, "# # gender", RYK. Gender)
& & Because the characters can only use the character to replace function, so the date and the number of type conversion must be carried out
ZYNR = STRTRAN (ZYNR, "# # date of birth", STR (YEAR (RYK. date of birth ))+'.'+ STR (MONT (RYK. date of birth ))+'.'+ STR (DAY ( RYK. date of birth)))
ZYNR = STRTRAN (ZYNR, "# # formerly", RYK. Formerly known as)
ZYNR = STRTRAN (ZYNR, "# # the nation", RYK. Nationalities)
ZYNR = STRTRAN (ZYNR, "# # working years", STR (YEAR (RYK. years working ))+'.'+ STR (MONT (RYK. years working ))+'.'+ STR (DAY ( RYK. the work of years)))
ZYNR = STRTRAN (ZYNR, "# # school time", STR (YEAR (RYK. time enrollment ))+'.'+ STR (MONT (RYK. time enrollment ))+'.'+ STR (DAY (RYK. school time)))
ZYNR = STRTRAN (ZYNR, "# # graduate of time", STR (YEAR (RYK. graduation time ))+'.'+ STR (MONT (RYK. graduation time ))+'.'+ STR (DAY (RYK. graduation time)))
ZYNR = STRTRAN (ZYNR, "# # graduate institutions", RYK. Graduate institutions)
ZYNR = STRTRAN (ZYNR, "# # Education", RYK. Qualifications)
ZYNR = STRTRAN (ZYNR, "# # The Science", RYK. Specialties)
ZYNR = STRTRAN (ZYNR, "# # home address", RYK. Home address)
ZYNR = STRTRAN (ZYNR, "# # Postal Code", RYK. Postcode)
ZYNR = STRTRAN (ZYNR, "# # Home", RYK. Home phone)
ZYNR = STRTRAN (ZYNR, "# # Home", RYK. Home phone)
ZYNR = STRTRAN (ZYNR, "# # mobile phone number", RYK. Mobile phone number)
ZYNR = STRTRAN (ZYNR, "# # work units", RYK. The work of units)
ZYNR = STRTRAN (ZYNR, "# # is any level", RYK. Is at any level)
ZYNR = STRTRAN (ZYNR, "# # CVs", RYK. CVs)
& & All replacement completed, the final outcome will generate a HTML document
= STRTOFILE (ZYNR, 'ABC.HTM')
The implementation of this program will automatically generate a name for ABC.HTM document in a browser to view this paper as follows:
We found that the relevant fields in the database content into the page content, so very convenient to the contents of the database format to the output page. In the practical application of the process can also be designed in advance to generate a large number of different styles of web pages stored in the database, use this database to facilitate the realization of various types of web pages to output, expand the database of the application of data content.
The above two methods can be carried out in accordance with the requirements of different use, in the realization of applications can also execute the query in the database, and then the results of queries to generate page views, applications will be more flexible, interested readers may wish to try.
Visual FoxPro Tutorial Articles
- VFP edit box method for automatic correction
- Visual FoxPro 9.0 is more powerful
- Dbf of how to use VFP to SQL Server 7.0 Distributed Query
- VFP the secondary development of smart sensors
- The contents of two databases on the output HTML format methods
- FoxWeb line with the rapid release of your database FOXPRO
- In Chinese and English to achieve VFP5.0 automatically switch
- In VFP to achieve with the combination of variant and an oval frame graphics menu
- Programmed to run through a dial-up network connection
- VFP to achieve in your browser to run the application method
- Visual FoxPro Application for increase in file compression
- Animation of simulation in the VFP
- Using Visual FoxPro 5.0 design data file structure browser
- VFP table tracking method
- In VFP print statements to achieve the specified number of records per page
- Procedures to allow VFP to run in a browser
- Visual FoxPro how to add and remove the network connection
- VFP and SQL SERVER like to do with C / S system
- OK karaoke subtitles colored dynamic display
- In a networked environment using Foxpro database management software developed under the Experience
Can't Find What You're Looking For?
Rating: Not yet rated