FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index mod_harbour redirecting index.prg
Posts: 179
Joined: Fri Dec 07, 2007 01:26 PM
redirecting index.prg
Posted: Fri Jul 30, 2021 08:01 AM
Dear friends,

I have to make a redirection on an existing index.prg.
When I insert the following code I get an error ...
Code (fw): Select all Collapse
<!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 (fw): Select all Collapse
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
Posts: 6755
Joined: Wed Feb 15, 2012 08:25 PM
Re: redirecting index.prg
Posted: Fri Jul 30, 2021 09:32 AM
Dear Ruth
Your index.prg It must have Harbour instructions.
This is a possibility to implement it.
Code (fw): Select all Collapse
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
Cristobal Navarro

Hay dos tipos de personas: las que te hacen perder el tiempo y las que te hacen perder la noción del tiempo

El secreto de la felicidad no está en hacer lo que te gusta, sino en que te guste lo que haces
Posts: 44158
Joined: Thu Oct 06, 2005 05:47 PM
Re: redirecting index.prg
Posted: Fri Jul 30, 2021 03:03 PM
Dear Ruth,

Code (fw): Select all Collapse
function Redirect( cUrl )

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

return nil
regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 179
Joined: Fri Dec 07, 2007 01:26 PM
Re: redirecting index.prg
Posted: Sat Jul 31, 2021 06:22 PM

Thank you two so much...this made my day :-) now the redirect is working fine...thanks a lot again and have a nice weekend...

Posts: 129
Joined: Mon Oct 17, 2005 03:03 AM
Re: redirecting index.prg
Posted: Thu Aug 19, 2021 08:33 AM
You can refer to: http://www4.zzz.com.tw/phpBB3/viewtopic.php?f=2&t=356

and you can use:
Code (fw): Select all Collapse
<!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>
line ID: ssbbstw

WeChat ID: ssbbstw
Posts: 6983
Joined: Fri Oct 07, 2005 07:07 PM
Re: redirecting index.prg
Posted: Thu Aug 19, 2021 09:15 AM

Hello,
Thank you. Very interesting. Can you describe the concept in more detail?
Best regards,
Otto

Posts: 129
Joined: Mon Oct 17, 2005 03:03 AM
Re: redirecting index.prg
Posted: Thu Aug 19, 2021 09:30 AM

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!

line ID: ssbbstw

WeChat ID: ssbbstw
Posts: 44158
Joined: Thu Oct 06, 2005 05:47 PM
Re: redirecting index.prg
Posted: Thu Aug 19, 2021 10:39 AM
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 :-)
regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 44158
Joined: Thu Oct 06, 2005 05:47 PM
Re: redirecting index.prg
Posted: Thu Aug 19, 2021 10:41 AM
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 :-)
regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 129
Joined: Mon Oct 17, 2005 03:03 AM
Re: redirecting index.prg
Posted: Sat Aug 21, 2021 04:55 AM
*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:


download it:
line ID: ssbbstw

WeChat ID: ssbbstw

Continue the discussion