How does mod harbour work

mod_harbour is an Apache module that allows to run PRGs directly on the web !!!
Post Reply
User avatar
Otto
Posts: 6396
Joined: Fri Oct 07, 2005 7:07 pm
Has thanked: 8 times
Been thanked: 1 time
Contact:

How does mod harbour work

Post by Otto »

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: 6396
Joined: Fri Oct 07, 2005 7:07 pm
Has thanked: 8 times
Been thanked: 1 time
Contact:

Re: How does mod harbour work

Post by Otto »

Image

Image
********************************************************************
mod harbour - Vamos a la conquista de la Web
modharbour.org
https://www.facebook.com/groups/modharbour.club
********************************************************************
User avatar
Otto
Posts: 6396
Joined: Fri Oct 07, 2005 7:07 pm
Has thanked: 8 times
Been thanked: 1 time
Contact:

Re: How does mod harbour work

Post by Otto »

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
Antonio Linares
Site Admin
Posts: 42395
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain
Has thanked: 10 times
Been thanked: 41 times
Contact:

Re: How does mod harbour work

Post by Antonio Linares »

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
Ruth
Posts: 172
Joined: Fri Dec 07, 2007 1:26 pm
Contact:

Re: How does mod harbour work

Post by Ruth »

Dear friends,

I use

Code: Select all | Expand

ENDTEXT
? "test1"
? "test2"
TEMPLATE
 
which works fine...

but would prefer something like this in some situations...

Code: Select all | Expand

<?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

<?prg
return "test4"
?>
but not multiline

Code: Select all | Expand

<?prg
return "test4"
return "test5"
?>
Thank you a lot in advance and kind regards
Ruth
User avatar
Ruth
Posts: 172
Joined: Fri Dec 07, 2007 1:26 pm
Contact:

Re: How does mod harbour work

Post by Ruth »

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

<?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
Antonio Linares
Site Admin
Posts: 42395
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain
Has thanked: 10 times
Been thanked: 41 times
Contact:

Re: How does mod harbour work

Post by Antonio Linares »

Ruth wrote:Dear friends,

I use

Code: Select all | Expand

ENDTEXT
? "test1"
? "test2"
TEMPLATE
 
which works fine...

but would prefer something like this in some situations...

Code: Select all | Expand

<?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

<?prg
return "test4"
?>
but not multiline

Code: Select all | Expand

<?prg
return "test4"
return "test5"
?>
Thank you a lot in advance and kind regards
Ruth
Dear Ruth,

Instead of doing:

Code: Select all | Expand

<?prg
? "test3"
?>
use:

Code: Select all | Expand

<?prg
AP_RPUTS( "test3" )
?>
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
Posts: 42395
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain
Has thanked: 10 times
Been thanked: 41 times
Contact:

Re: How does mod harbour work

Post by Antonio Linares »

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

<?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
Ruth
Posts: 172
Joined: Fri Dec 07, 2007 1:26 pm
Contact:

Re: How does mod harbour work

Post by Ruth »

dear antonio, thank you very much for your answers and your kind help. kind regards and have a nice day ruth
Post Reply