FpWeb and template
lazarus / 38-Networking and Web Programming
----------------------------------------------------------------------
xinyiman · 2017-06-27 10:42
Hi guys, I have a question! I'm working with fpweb, but I can not use
the templates well. Attached an example, you will see that if you run
the executable you will get a result, and if you launch the
/files/index.html file manually in the browser you will see another
result. It does not seem to load css and js files through templates.
How can I do? Thank you
----------------------------------------------------------------------
xinyiman · 2017-06-28 06:24
No help?
----------------------------------------------------------------------
nummer8 · 2017-06-28 07:30
Hi,
If you view the source code of the web page and try to click one of
the bootstrap file you will notice that the file is not accessible.
Try to make the project as a cgi and use a real web-server. The
bootstrap files will be served by the webserver.
The internal http server has no knowledge of the external files.
Maybe some one else can explain how to achieve this with a http server
project.
The only info I can find is how to serve statical files directly from
the program as you did with your index.html.
Jos
----------------------------------------------------------------------
xinyiman · 2017-06-28 09:22
Yes, after the tests have come to the same conclusion. Now I want to
figure out how to fix the problem.
----------------------------------------------------------------------
xinyiman · 2017-06-30 13:08
A few steps forward has been made, now I search for all the files in a
folder and their sub folders and I include them.
But if you launch the example you will see that
http://localhost:9020/index
it's different from
http://localhost:9020/home
What I do not understand is because home does not act as an index. In
the index i refer to the libraries on the web, in the home I refer to
the libraries on the filesystem. Who can explain why ?! Thank you
----------------------------------------------------------------------
Leledumbo · 2017-06-30 21:28
You name the variables:
Quote
Bootstrap Example
but you try to replace:
Quoteapp.Text:=stringReplace(app.Text, '', librerie_js,
[RfReplaceAll]);
app.Text:=stringReplace(app.Text, '', fogli_stile,
[RfReplaceAll]);
Still, even after fixing those, you won't get your bootstrap working
because you're missing jquery in the line. You're also doing
unnecessary things by including the CONTENTS of bootstrap CSS/JS,
simply generate links to them as in the /index handler.
Quote from: nummer8 on June 28, 2017, 09:30:50 amMaybe some one else
can explain how to achieve this with a http server project.
Unit:
https://svn.freepascal.org/svn/fpc/tags/release_3_0_2/packages/fcl-
web/src/base/fpwebfile.pp
Example:
https://svn.freepascal.org/svn/fpc/tags/release_3_0_2/packages/fcl-
web/examples/httpapp/testhttp.pp
----------------------------------------------------------------------
xinyiman · 2017-07-01 17:12
Hi leledumbo, thanks for the links. But I can not make it work as I
want. The link below will let you download my new example (2.1 MB)
including bootstrap sources. Can you tell me where I am wrong? You
just have to run it
www.lazaruspascal.it/esempi/webproject_neutro.zip
localhost:9090
Code: Pascal [Select][+][-]window.onload = function(){var x1 =
document.getElementById("main_content_section"); if (x1) { var x =
document.getElementsByClassName("geshi");for (var i = 0; i The
application encountered the following error: Error: Could not
determine HTTP module for request "" Stack trace: $00084EDD
$00084F96 $00084C3C $00085443 $0007B4AE $00089AAD
$000894F3 $0006945A
Quote from: Leledumbo on June 30, 2017, 11:28:03 pmYou name the
variables:
Quote
Bootstrap Example
but you try to replace:
Quoteapp.Text:=stringReplace(app.Text, '', librerie_js,
[RfReplaceAll]);
app.Text:=stringReplace(app.Text, '', fogli_stile,
[RfReplaceAll]);
Still, even after fixing those, you won't get your bootstrap working
because you're missing jquery in the line. You're also doing
unnecessary things by including the CONTENTS of bootstrap CSS/JS,
simply generate links to them as in the /index handler.
Quote from: nummer8 on June 28, 2017, 09:30:50 amMaybe some one else
can explain how to achieve this with a http server project.
Unit:
https://svn.freepascal.org/svn/fpc/tags/release_3_0_2/packages/fcl-
web/src/base/fpwebfile.pp
Example:
https://svn.freepascal.org/svn/fpc/tags/release_3_0_2/packages/fcl-
web/examples/httpapp/testhttp.pp
----------------------------------------------------------------------
Leledumbo · 2017-07-01 22:24
Re-read my tutorial about routing, you have multiple routes
registered, none of these handle empty path info.
----------------------------------------------------------------------
xinyiman · 2017-07-02 08:03
Link of tutorial please
----------------------------------------------------------------------
nummer8 · 2017-07-02 08:30
http://forum.lazarus-ide.org/index.php/topic,29055.0.html
----------------------------------------------------------------------
xinyiman · 2017-07-02 15:12
OK! I got it. I do not understand why I do not load bootstrap
libraries. I can see the contents of the index.html file but can not
see them as I should.
----------------------------------------------------------------------
Leledumbo · 2017-07-02 16:29
Load just fine for me (except favicon.ico).
EDIT:
My bad, I didn't check those responses, actually those script's src
and link's href are returning the same html. You should prepend them
with /, otherwise it will be considered relative to the path info
instead of the host. With that fixed, the resulting page should be
like the second image.
----------------------------------------------------------------------
xinyiman · 2017-07-02 18:29
Sorry I did not understand, you could modify my source so I
understand. Thank you
----------------------------------------------------------------------
xinyiman · 2017-07-04 09:49
I apologize for leledumbo, where I have to go to put / to get the
correct result. I did not understand it.
----------------------------------------------------------------------
cgd · 2019-07-24 22:12
xinyiman did you finally got it working? I am new using Lazarus
fpweb... Could you please post the complete example package for a good
understanding? Thank you so much.
----------------------------------------------------------------------
xinyiman · 2019-08-14 06:57
Hi, no I had abandoned that project at the end