How does mod harbour work

mod_harbour is an Apache module that allows to run PRGs directly on the web !!!

How does mod harbour work

Postby Otto » Thu Jun 09, 2022 4:16 pm

Dear Antonio,
can you please show us how mod harbour works?

Can we say?
<?php and ?>
is the equivalent for
TEMPLATE
ENDTEXT
in mod harbour and that this PHP description is valid for mod harbour, too?

Best regards,
Otto



PHP tags
When PHP parses a file, it looks for opening and closing tags, which are <?php and ?> which tell PHP to start and stop interpreting the code between them. Parsing in this manner allows PHP to be embedded in all sorts of different documents, as everything outside of a pair of opening and closing tags is ignored by the PHP parser.

PHP includes a short echo tag <?= which is a short-hand to the more verbose <?php echo.
********************************************************************
mod harbour - Vamos a la conquista de la Web
modharbour.org
https://www.facebook.com/groups/modharbour.club
********************************************************************
User avatar
Otto
 
Posts: 6332
Joined: Fri Oct 07, 2005 7:07 pm

Re: How does mod harbour work

Postby Otto » Thu Jun 09, 2022 4:22 pm

Image

Image
********************************************************************
mod harbour - Vamos a la conquista de la Web
modharbour.org
https://www.facebook.com/groups/modharbour.club
********************************************************************
User avatar
Otto
 
Posts: 6332
Joined: Fri Oct 07, 2005 7:07 pm

Re: How does mod harbour work

Postby Otto » Fri Jun 10, 2022 7:14 am

Hello friends,

In mod harbour we have Harbour as a language by default.
In PHP/ASP I think HTML and then you switch with <scritpt>.
In mod harbour is HARBOUR first.

This is what a person switching from HTML or PHP does not understand at first.

What are the technical terms for this?

Angel Pais, 19:23
?

19:26
Ruth says for a coherent syntax we (HARBOUR users) should use

<script type="application/harbour"> instead of TEMPLATE.

But for us it should be
<script type="application/html">.
I'm between the lines here.
We want as much HABOUR syntax as possible and the newcomers who don't know HARBOUR as little as possible.

Best regards,
Otto
********************************************************************
mod harbour - Vamos a la conquista de la Web
modharbour.org
https://www.facebook.com/groups/modharbour.club
********************************************************************
User avatar
Otto
 
Posts: 6332
Joined: Fri Oct 07, 2005 7:07 pm

Re: How does mod harbour work

Postby Antonio Linares » Fri Jun 10, 2022 11:11 am

Dear Otto,

Harbour is very powerful using strings, so basically what we do is search for "<?prg" and then for "?>" and what it is in between is compiled and replaced :-)

Harbour incredibly feature to compile in runtime lets us do incredibly things.

that simple ;-)
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 42097
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Re: How does mod harbour work

Postby Ruth » Mon Jan 15, 2024 9:19 am

Dear friends,

I use
Code: Select all  Expand view

ENDTEXT
? "test1"
? "test2"
TEMPLATE
 

which works fine...

but would prefer something like this in some situations...
Code: Select all  Expand view
<?prg
? "test3"
?>

do I need to escape the "?" in this context, because the code-example doesnt seem to work.

what is working
Code: Select all  Expand view

<?prg
return "test4"
?>

but not multiline
Code: Select all  Expand view

<?prg
return "test4"
return "test5"
?>


Thank you a lot in advance and kind regards
Ruth
User avatar
Ruth
 
Posts: 169
Joined: Fri Dec 07, 2007 1:26 pm

Re: How does mod harbour work

Postby Ruth » Mon Jan 15, 2024 9:35 am

Dear team,


I kindly want to ask another question about "How does mod harbour work".
On some occasions I get very useful error messages - like for example
Error: LOCAL declaration follows executable statement
operation: line:593
called from: HB_COMPILEFROMBUF, line: 0
called from: ..\source\exec.prg, EXECUTE, line: 68

Source:
0066: cPRGPATH := hb_GetEnv( "PRGPATH" )
0067: cPRGPATH := STRTRAN( cPRGPATH , "/", "\" )
0068 =>cdbf_BLOG := cPRGPATH+ "\data\BLOG.DBF"
0069: lRecord := .T.
0070:


but I make a lot of other mistakes too, where I don´t "see" the error right away ... like for example trying to return a numeric value
Code: Select all  Expand view
<?prg return hWarenkorb["Variante2"]["Zimmer1"]["Subtotal"] ?>

could I set up some error messages somewhere for my common mistakes? so that the programm "tells" me "Error: STR() missing for numeric value..."


thanks again for your attention and kind regards
ruth
User avatar
Ruth
 
Posts: 169
Joined: Fri Dec 07, 2007 1:26 pm

Re: How does mod harbour work

Postby Antonio Linares » Mon Jan 15, 2024 12:33 pm

Ruth wrote:Dear friends,

I use
Code: Select all  Expand view

ENDTEXT
? "test1"
? "test2"
TEMPLATE
 

which works fine...

but would prefer something like this in some situations...
Code: Select all  Expand view
<?prg
? "test3"
?>

do I need to escape the "?" in this context, because the code-example doesnt seem to work.

what is working
Code: Select all  Expand view

<?prg
return "test4"
?>

but not multiline
Code: Select all  Expand view

<?prg
return "test4"
return "test5"
?>


Thank you a lot in advance and kind regards
Ruth


Dear Ruth,

Instead of doing:
Code: Select all  Expand view
<?prg
? "test3"
?>

use:
Code: Select all  Expand view
<?prg
AP_RPUTS( "test3" )
?>
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 42097
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Re: How does mod harbour work

Postby Antonio Linares » Mon Jan 15, 2024 12:38 pm

Ruth wrote:Dear team,


I kindly want to ask another question about "How does mod harbour work".
On some occasions I get very useful error messages - like for example
Error: LOCAL declaration follows executable statement
operation: line:593
called from: HB_COMPILEFROMBUF, line: 0
called from: ..\source\exec.prg, EXECUTE, line: 68

Source:
0066: cPRGPATH := hb_GetEnv( "PRGPATH" )
0067: cPRGPATH := STRTRAN( cPRGPATH , "/", "\" )
0068 =>cdbf_BLOG := cPRGPATH+ "\data\BLOG.DBF"
0069: lRecord := .T.
0070:


but I make a lot of other mistakes too, where I don´t "see" the error right away ... like for example trying to return a numeric value
Code: Select all  Expand view
<?prg return hWarenkorb["Variante2"]["Zimmer1"]["Subtotal"] ?>

could I set up some error messages somewhere for my common mistakes? so that the programm "tells" me "Error: STR() missing for numeric value..."


thanks again for your attention and kind regards
ruth


Dear Ruth,

mod_harbour errors handling sometimes is not very usefull, I agree with you.
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 42097
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Re: How does mod harbour work

Postby Ruth » Mon Jan 15, 2024 12:59 pm

dear antonio, thank you very much for your answers and your kind help. kind regards and have a nice day ruth
User avatar
Ruth
 
Posts: 169
Joined: Fri Dec 07, 2007 1:26 pm


Return to mod_harbour

Who is online

Users browsing this forum: No registered users and 5 guests