As mentioned in another thread in the forums people where interested I share a application I have written that converts HTML documents to PHP. Here is the application and details.
Allows you to write PHP in Custom Code tags, and convers this from HTML encoding back into plain text.
Removes .html from all links on your page, this does require you setup an .htaccess file
Easy file explorer to find the pages you want to convert.
Can just strip .html from links if you choose Keep .html
Bulk file conversion
No technical knowledge required to setup and run the application.
Progress bar tracks what file it is working on.
Error reporting for if it finds issues.
How to use the application
Export your design from Bootstrap Studio to one folder.
Open the application.
Click Browse.
Search and select the parent folder that contains your CSS, JS, Images, HTML files.
Click OK
Choose if you just want to strip .html from links by selecting Keep .html OR choose convert to .php to convert your PHP code and the file extensions into PHP.
Wait for the program to finish.
Support
Please leave a message below if you have any issues, I shall be happy to assist when I have a moment. If you have feature suggestions I am willing to take them on, however please remember this is provided as is for free and developed in my spare time.
Download
The file is provided as a .exe file, It is just a PowerShell script under the hood.
I have never understood why one would want to write PHP in an app that does not support PHP. Who wants to write a Laravel app with a frontend-only setup?
If you use the Custom Code element in Bootstrap Studio, then export your design the PHP code is HTML encoded so doesn’t run, which is something this script fixes.
I usually use the Custom Code element to add PHP that adds the copyright year, and I include partials, like the header or footer for the pages so I can just update one file. The conversation script is intended purpose is for small things like this.
I was not disagreeing that it would not, nor am I disagreeing that you should not use .html files that have PHP code in them, I know you can configure a server to run PHP within a .html file. However, it is my personal preference not to do this due to the extra configuration required, its not default behaviour. Making files that run PHP code have the .php extension removes any ambiguity for what those files run, and requires no further setup for end users of the application.
If you write PHP code within bootstrap studio that is not in a custom code block, then export your design, text becomes HTML encoded, so your code becomes:
<div><?php echo date() ?></div>
Hence why PHP code would not ordinarily run. The application resolves any detected HTML encoding issue if you choose to convert the files to PHP, by smartly picking out the PHP blocks from the HTML.
If you prefer working with .html files with PHP code inside them, you can rename the extensions after the conversion. Its really up to the way you wish to work on your sites.
I hope this is more clear, and I appreciate your interest.