Page 1 of 1

redirecting index.prg

PostPosted: Fri Jul 30, 2021 8:01 am
by Ruth
Dear friends,

I have to make a redirection on an existing index.prg.
When I insert the following code I get an error ...
Code: Select all  Expand view
<!DOCTYPE html>
<html>
<head>
  <meta http-equiv="refresh" content="2; URL=https://www.winhotel.space/lp/bergland_sillian/landingpage1.prg">
</head>
<body>

<h1>My Website</h1>
<p>Some text...</p>

</body>
</html>
 


The link is https://www.winhotel.space/mm_69RO24_bergland/index.prg

And the error is
Code: Select all  Expand view
Error: Syntax error "syntax error at '<'"
operation: line:1
called from: HB_COMPILEFROMBUF, line: 0
called from: ..\source\exec.prg, EXECUTE, line: 68

Source:


Maybe someone can help me please...very kind regards and thanks in advance
Ruth

Re: redirecting index.prg

PostPosted: Fri Jul 30, 2021 9:32 am
by cnavarro
Dear Ruth
Your index.prg It must have Harbour instructions.
This is a possibility to implement it.
Code: Select all  Expand view


Function Main()
local cHtml

TEXT INTO cHtml
<!DOCTYPE html>
<html>
<head>
  <meta http-equiv="refresh" content="2; URL=https://www.winhotel.space/lp/bergland_sillian/landingpage1.prg">
</head>
<body>

<h1>My Website</h1>
<p>Some text...</p>

</body>
</html>
 ENDTEXT

  ? cHtml
Return nil
 

Re: redirecting index.prg

PostPosted: Fri Jul 30, 2021 3:03 pm
by Antonio Linares
Dear Ruth,

Code: Select all  Expand view
function Redirect( cUrl )

   AP_RPuts( "<script>window.location.href ='" + cUrl + "'</script>" )

return nil

Re: redirecting index.prg

PostPosted: Sat Jul 31, 2021 6:22 pm
by Ruth
Thank you two so much...this made my day :-) now the redirect is working fine...thanks a lot again and have a nice weekend...

Re: redirecting index.prg

PostPosted: Thu Aug 19, 2021 8:33 am
by ssbbs
You can refer to: http://www4.zzz.com.tw/phpBB3/viewtopic.php?f=2&t=356

and you can use:
Code: Select all  Expand view

<!DOCTYPE html>
<html>
<head>
  <meta http-equiv="refresh" content="2; URL=https://www.winhotel.space/lp/bergland_sillian/landingpage1.prg">
</head>
<body>

<h1>My Website</h1>
<p><?prg reindex() ?></p>

</body>
</html>
 

Re: redirecting index.prg

PostPosted: Thu Aug 19, 2021 9:15 am
by Otto
Hello,
Thank you. Very interesting. Can you describe the concept in more detail?
Best regards,
Otto

Re: redirecting index.prg

PostPosted: Thu Aug 19, 2021 9:30 am
by ssbbs
You can use WYSIWYG web design software to design your website and embedded into prg code like PHP in general.
but save file name is .prg not .php
open browser and open the .prg
This is the closest web design mode!

Re: redirecting index.prg

PostPosted: Thu Aug 19, 2021 10:39 am
by Antonio Linares
https://css-tricks.com/snippets/html/meta-refresh/

Very nice to find that there is a lot of interest for mod_harbour from our Chinese brothers :-)

Re: redirecting index.prg

PostPosted: Thu Aug 19, 2021 10:41 am
by Antonio Linares
ssbbs wrote:You can use WYSIWYG web design software to design your website and embedded into prg code like PHP in general.
but save file name is .prg not .php
open browser and open the .prg
This is the closest web design mode!


We do appreciate if you could post here some screenshots. It seems very interesting :-)

Re: redirecting index.prg

PostPosted: Sat Aug 21, 2021 4:55 am
by ssbbs
*2021.08.21: fix
1. Fix: If there is no'<?prg' and '?>' in the entire webpage, it will cause a failure error message.

2. New addition: <?php ... ?> and <?prg ... ?> can be executed simultaneously in HTML.
Description: The execution order: first execute PHP code before execution PRG code.
This function cannot be executed correctly when the extension is .hrb, because .hrb is pre-compiled and cannot be called again to recompile PHP!
It must be set to call to get php under the path (SET PATH=...).
Or to set environment variables: 'PHP_PATH'

Execution result & part of the code:
Image

download it: