Change html extension to php on export

I finally figured this out and it is so simple. I created a windows bat file call php.bat. I used the Text Editor.

In the bat file I have the code:

cd C:\Users\User\Desktop\BootstrapTest\
ren *.html *.php

Then I set the path to the Export script in the Advanced Export Settings


(The bat file has to be in the Export Folder)

Hit export and all the html extensions change to php.

Adding to your solution you could change your php.bat to read:

set arg1=%1 cd %arg1% ren *.html *.php

Bootstrap Studio will automatically send the export folder in arg1 so you can just use one batch file for different jobs, also it won't need to be in the export folder

Thanks Richard, that works.

I have not spent much time refining this but opens up lots of possibilities. Your code works great. I have added a slight modification to delete any php files first before the rename procedure happens which lets me continue to update the export folder with the new renamed php files.

Just a side question. Do you know of any method that would automate a task to open a html file after export and run a jquery task and then save the resulting html as a new file?

As a example I have a regular block of code that is displayed while designing, however it is switched out with a jquery task to hide that block of code and then unhide another that is in a custom html block that contains php code for a cms I am using.

Rather than complete this task on page load in the browser, I would like to upload the already edited html file that has had the jquery task already run which would remove the code (by id's) instead of hiding.

Is this something possible ?

The problem might be all the internal links will not work any longer because they are not changed by this solution. I did it in a completely different way. i configured my server to parse all html pages as php files. works perfectly...

Just wanted to say thanks as this has proven to be a great help to me, one note, I am (for now) maintaining two copies of each page in my project, one without any PHP so that I can experiment with layout and appearance then another with PHP included. In my case I have found it convenient to name the PHP version <i>pagename</i>-php.php then modify the BAT file as below:

set arg1=%1
cd %arg1%
del *php.php
ren *php.html *.php

Not a huge change but I think pretty convenient if you want to maintain both and easily identify which is which (i.e. which have embedded php code)

Is there any way to have it so the bat deletes the current .php page?

<hr />

Tue Jul 16 2019 02:57:44 GMT-0400 (Eastern Daylight Time)

A duplicate file name exists, or the file cannot be found. A duplicate file name exists, or the file cannot be found.

This is my current bat

cd C:\Users\Mike\Desktop\MusicTrak LSP\New_Devel\ del *php.php ren *.html *.php

Figured it out!

cd C:\Users\Mike\Desktop\MusicTrak LSP\New_Devel\ del /S *.php ren *.html *.php Next I'll have to figure out how to have it delete all within the project so in case I have folders like /include etc.

Has anyone figured out how to deal with internal links? I have anchors in my Navigation which fail when I go to another page so I had to add in the rest of the URL. The problem is that now either my preview doesn’t work properly or the final exported file doesn’t work. I can’t get both working at the same time.

Wouldn’t it be much easier to just have a check mark in the menu of BS that sets all pages to .PHP instead of HTML to begin with so that everything just works?

I see that we can do the “rename” thing so we can exclude the file extension but I don’t think that will help with the preview since it would have to be done server side… Might help with SEO though lol.


Forgive my ignorance, but wouldn’t it be easier to just use a website builder that is designed specifically to work with backend languages like PHP? Bootstrap Studio is designed to build static front-end websites.

It sounds like you’re trying to force a square peg into a round hole.

Not really it’s just a line of code but I don’t want to make my site heavy with javascript when server-side is a much more effecient way of doing things.

I got everything working in the end anyway for the most part: I just removed the extension in all my links on my web-server.

page load-time is a huge SEO boost in competitive industries.

I’m not developing web-apps or anything.

@mrnagy88 To be honest, this is totally in the wrong place for the answers you seek or the possibilities you offer. You may want to post in the Ideas forum and reference this thread to offer the ideas you have posted to the Dev team. Here in this thread they are falling on user’s ears mostly (so to speak) and the Devs tend to see things in the Ideas thread more than the rest so maybe posting there will give them some ideas for a future update. Just a thought. :slight_smile: