FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index mod_harbour xtranslate
Posts: 6983
Joined: Fri Oct 07, 2005 07:07 PM
xtranslate
Posted: Sat Sep 14, 2019 07: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

Posts: 6983
Joined: Fri Oct 07, 2005 07:07 PM
Re: xtranslate
Posted: Sat Sep 14, 2019 07: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

Continue the discussion