xtranslate

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

xtranslate

Postby Otto » Sat Sep 14, 2019 7:12 am

Dear Antonio,
is there a way that we could xTranslate {{ }} inside BLOCK that we could use xBase code inside Block like this:
{{Date()}} mHb_date()

Thank you in advance
Otto

#xtranslate

function Main()
? "Seconds {%Seconds()%} before compilation<br><br>"
BLOCKS

Current date is {{Date()}}
Current date is mhb_date()

ENDTEXT

return nil
********************************************************************
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: xtranslate

Postby Otto » Sat Sep 14, 2019 7:57 am

Otto, you may use this:
09:32 Uhr
#xcommand BLOCKS [ PARAMS [<v1>] [,<vn>] ] => ;
#pragma __cstream | AP_RPuts( ReplaceBlocks( MyTranslate( %s ), "{{", "}}" [,<(v1)>][+","+<(vn)>] [, @<v1>][, @<vn>] ) )

function Main()

BLOCKS
mhb_date()
<br>
mhb_time()
ENDTEXT

return nil

function MyTranslate( cText )

cText = StrTran( cText, "mhb_date()", "{{Date()}}" )
cText = StrTran( cText, "mhb_time()", "{{Time()}}" )

return cText
09:32 Uhr
Tested from IIS mod_harbour
********************************************************************
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


Return to mod_harbour

Who is online

Users browsing this forum: No registered users and 8 guests