I have published the TWeb for mod Harbour, so that it can be freely used in your programs in a web environment.
The easiest way to create a web screen using our usual xBase syntax
A simple example of how to create a web form that makes a request to our server and that returns a response
https://54.37.60.33/htweb/tutor10.prg
The code that designs the browser screen
- Code: Select all Expand view
- // {% LoadHrb( 'lib/tweb/tweb.hrb' ) %}
#include {% TWebInclude() %}
function main()
LOCAL o
DEFINE WEB oWeb TITLE 'Tutor10' INIT
DEFINE FORM o ID 'demo'
HTML o INLINE '<h3>Test MsgServer()</h3><hr>'
INIT FORM o
GET ID 'myid' VALUE '123' GRID 12 LABEL 'Id.' BUTTON 'GetId' ACTION 'GetId()' OF o
HTML o
<script>
function GetId() {
var cId = $('#myid').val()
MsgServer( 'tutor10-server.prg', cId, PostCall )
}
function PostCall( data ) {
MsgInfo( data )
}
</script>
ENDTEXT
END FORM o
retu nil
And the part of the backend that is in the server and listens to our requests
- Code: Select all Expand view
- function main()
local hParam := AP_PostPairs()
?? 'Server time: ' + time() + '. Welcome ' + hParam[ 'value' ]
retu nil
And this is the basis to be able to quickly and easily create our web pages using the new mod_harbour.
You can easily test, modify, run the examples until you can manage browsers.
https://54.37.60.33/htweb/tutor4b.prg
In this link you will have all the information and the different examples that are already operational
https://54.37.60.33/htweb/index_en.html
I invite everyone to try mod Harbour to be able to make the definitive leap to the web using our usual xBase. It has never been so easy to access the web with our beloved Harbour.
Any questions you can post on the mod-harbour forum -> -> https://forum.mod-harbour.org/viewforum.php?f=7
Enjoy it
Regards
C.