How to write a script to create an HTML page?
Posted: Sun Feb 08, 2015 5:26 am
				
				dear friends, i have the following Gambas3 code (only partial code). With this code a create an html page:
  
if a write the following code i can't create any html page, the variable strip my code:
Have you some help for me? Thx for all.
			Code: Select all
  hFile = Open Application.Path & "/test.html" For Create
  Print #hFile, "<!--"
  Print #hFile, "You are free to copy and use this sample in accordance with the terms of the"
  Print #hFile, "Apache license (http://www.apache.org/licenses/LICENSE-2.0.html)"
  Print #hFile, "-->"
  Print #hFile, ""
  Print #hFile, "<!DOCTYPE html PUBLIC '-//W3C//DTD XHTML 1.0 Strict//EN' 'http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd'>"
  Print #hFile, "<html xmlns='http://www.w3.org/1999/xhtml'>"
  Print #hFile, "<head>"
  Print #hFile, "<meta http-equiv='content-type' content='text/html; charset=utf-8'/>"
  Print #hFile, "<title>"
  Print #hFile, "test"
  Print #hFile, "</title>"
Code: Select all
on mouseUp 
   local myVar
   open file specialFolderPath("desktop") & "/myData.html" for write -- creates a file for Revolution to write to
   put "<!DOCTYPE html PUBLIC '-//W3C//DTD XHTML 1.0 Strict//EN' 'http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd'>" &  CR into myVar
   put myGoo into field "Field1"
   write myVar to file specialFolderPath("desktop") & "/myData.html" -- writes the text placed in the local variable into the open text file we created
   close file specialFolderPath("desktop") & "/myData.html" -- closes/saves the text file containing the text form the field/local variable into a text file on the desktop
end mouseUp