Recent

Author Topic: adminlte test  (Read 481 times)

xinyiman

  • Hero Member
  • *****
  • Posts: 1961
    • Lazarus and Free Pascal italian community
adminlte test
« on: September 06, 2019, 11:23:42 pm »
Hi guys, sometimes we try again. I want to create a small lazarus web application with adminLTE graphics. I had already tried indy, but now I want to try the native lazarus tools. If you decompress the example that I attach, you will see that in the bin / i386-win32 / folder you find a "files_extra" folder, to which you must manually add the "AdminLTE_Files" folder after downloading AdminLTE from the address:
https://github.com/ColorlibHQ/AdminLTE/archive/v2.4.18.zip

Move the content from the folder where you find the index.html file in the "AdminLTE_Files" folder

Change the paths in the uConsts.pas file based on where you place your example

Compile and run the example, then open the browser at: http://localhost:9090/adminlte_files/index.html

You will see that with firefox it works correctly, with chrome no. Who can explain me why? Moreover, assuming you want to change the html of the index.html when it appears in the browser, in your opinion what event should I use ?! The latter thing is used to enhance the variables to be presented to the browser.
Win10, Ubuntu and Mac
Lazarus: 2.1.0
FPC: 3.3.1

zamronypj

  • New Member
  • *
  • Posts: 39
    • Fano Framework, Free Pascal web application framework
Re: adminlte test
« Reply #1 on: September 07, 2019, 12:34:24 am »
I have not try your code. But you may want to take a look at chrome developer tools to inspect what is wrong.
Fano Framework, Free Pascal web application framework https://fanoframework.github.io
Personal Projects https://v3.juhara.com
Github https://github.com/zamronypj

xinyiman

  • Hero Member
  • *****
  • Posts: 1961
    • Lazarus and Free Pascal italian community
Re: adminlte test
« Reply #2 on: September 07, 2019, 06:14:55 pm »
Done, and this returns.
Code: Pascal  [Select]
  1. Content-Length: 52549
  2. Content-Type: addtype
  3. Status: 200 OK
  4.  
I just don't understand how to solve it. I do not think that "Content-Type: addtype". How solve?!
Win10, Ubuntu and Mac
Lazarus: 2.1.0
FPC: 3.3.1

zamronypj

  • New Member
  • *
  • Posts: 39
    • Fano Framework, Free Pascal web application framework
Re: adminlte test
« Reply #3 on: September 08, 2019, 03:39:03 pm »
You should add proper Content-Type response header. If you returns HTML document then it should be text/html

Code: [Select]
ARespons.ContentType :='text/html';
« Last Edit: September 08, 2019, 03:42:19 pm by zamronypj »
Fano Framework, Free Pascal web application framework https://fanoframework.github.io
Personal Projects https://v3.juhara.com
Github https://github.com/zamronypj

xinyiman

  • Hero Member
  • *****
  • Posts: 1961
    • Lazarus and Free Pascal italian community
Re: adminlte test
« Reply #4 on: September 08, 2019, 06:19:52 pm »
Thanks, but these are files that are not linked to the application, returned thanks to Serving Static Files (Embedded Web Server). So I don't know how
Win10, Ubuntu and Mac
Lazarus: 2.1.0
FPC: 3.3.1

zamronypj

  • New Member
  • *
  • Posts: 39
    • Fano Framework, Free Pascal web application framework
Re: adminlte test
« Reply #5 on: September 08, 2019, 11:42:20 pm »
I do not quite understand what you mean. But if you load static files, make sure you properly setup its MIME types based on its file extension.

AFAIK

Code: [Select]
uses
       ...
      fpmimetypes;
...
mimeTypes().loadfromFile(yourPathToMimeTypes);
Fano Framework, Free Pascal web application framework https://fanoframework.github.io
Personal Projects https://v3.juhara.com
Github https://github.com/zamronypj