When to Create PHP Files?

So here I am as a newbie, creating lots of little files to test things… and finding that a new file created in Wappler is by default a .html file.

So I’m wondering under what situations I should create a file which is .php instead?

Best wishes,
Antony.

Hello,
.php is required when you need some serverside code to run on your page.
The only functionality which requires a PHP page in Wappler is the security enforcer.
For everything else, you can use plain HTML pages.
But there is really no difference for your server if it’s an HTML or a PHP page, if you just run simple HTML code.

Thanks @Teodor!

So to keep it really simple and avoid any problems, could you say:

  • If you have a database or use security, make all pages .php
  • If you don’t, make all pages .html

…?

No,
If you use database you can still use HTML as no PHP code is used in the page, to display the dynamic data. App Connect, which is a JavaScript framework is used for that. :slight_smile:

Only use PHP if you need to restrict access to the page using the security enforcer.

2 Likes

actually if you look at the little down caret next to the + to add new html file, it gives you other options of what type of file you want to add.