PHP and other code intergration

I take it there's no way to use Bootstrap Studio to add PHP code and other code other than bootstrap?

Currently I use Bootstrap Studio to design my site then use a text editor to insert the PHP code. The issue with that is if I need to update my site design in bootstrap studio my PHP code is not there and have to reexport the code then use the text editor to add the PHP code all over again. This means sadness because I love bootstrap studio.

**

<h1>If I missed how to put PHP code into my code using bootstrap studio and have it save to BSdesign files so the PHP code stays please let me know!</h1>

**

If there is to a way maybe the developers can add a edit raw code button that lets you edit the code in raw form with the editor you select or open the folder the file is in to edit it manually to insert PHP etc. then after you save it then return to bootstrap studio and click another button that will load code from raw edit and import the changes to bootstrap studio so it saves the changes to the .BSdesign files.

Also be nice if the feature to rename the file extensions can be changed to PHP because people like me can uses apps like XAMPP to test the exported site.

You can put in the settings a advanced editor option that has to been enable the import from raw code file button not to confuse bootstrap only users. But honestly have not seen or found a bootstrap only developer yet!

These features would be great to have and make bootstrap studio better.

If you want to add php to your design then you need to insert a custom code component which will allow this - however please note your php won’t function within the app or the preview until you have exported and uploaded to your design to your server/virtual server.

Does that make sense ?

That help some I understand the PHP will not work until it's extracted and put the site on a server or virtual server until then it will be considered dead code.

Is there a way to insert a PHP file into Bootstrap Studio (example a con.php file)? Or do I have to make them .html files and rename everything after export from .html to .php when it's on a server?

Would be cool to be able to add .php files to the project until there extracted even if there dead code.

If not I can still use bootstrap studio to develop the pages and appreciate your help greatly. Thank you

1 Like

HASANSHAH = SPAMMER

Sorry but my English comes from Google. I believe, to interact BS with php, should be as follows:- 1-Create a project with an IDE any (I use NetBeans) 2-make your BS project and export it to www-your project (if you use Wamp or htdocs if using Xampp) 3-include in your php project the index.html from the BS exported with the include_once 4-run the IDE project and you will see in the browser your BS project working. 5-my index.pxp was like that:-<!DOCTYPE html> <html> <head> <meta charset=""UTF-8""> <title>SYSTEM X</title> </head> <body> <?php include_once="" 'conecta.php';="" include_once="" 'index.html';=""?> </body> </html>

I'm having trouble doing work details such as:- - the-answer button submits; - put data mysql tables in lists; - replace images in grids.

I know I have to put in my php page using code snippets <?php.....??> but don't know how to find refer to html commands. This is my challenge.

Don't forget, I love BS

Hi, can anyone give me an advise for my forum post on https://bootstrapstudio.io/forums/topic/bootstrap-with-composer/ Thanks.

This code works, and was inserted in the BSS with "customCode":-

<div> <? php echo "I'm in php"; ?> </div>

And as Cris said, it only works after exporting. It is a solution because there is always the need to export. It is solved the problem of treating buttons, forms and other things that may depend on PHP. The HTML part of a button submit, for example, has to sit in Custom Code too, in HTML....

If you want, you can encode everything in PHP and put in a file .php and load it, via Custom Code with a "require ". See the code in the Custom Code:-

<div> <? php require "submit button_insert.php; / for example ?> </div>

It would be nice to have the to save the file as HTML or PHP. it will still run the same as normal apart from the c0de will error. but that's OK. it would save a lot of work at the final test stage. this is the major let down of Bootstrap Studio.

Barry

I would like to see the IDE ignore PHP code and the server component suppress php code in its output so the html is not broken when previewing.

This would need to happen in both the renderer in bootstrapstudio and the webserver component

It would also be nice to be able to use an external webserver so you could see your design progress while you are building it, complete with the rendered PHP Auto refreshes of course would be somewhat harder.

I see bootstrapstudio already tries to do this by commenting out any php code so <?php ... ?> becomes <!--?php ... ?--> unfortunately it does not do this for php within an elements attributes therefore rendering breaks for example <footer class="footer <?php print $container_class; ?>"> is not rewritten to hide the php

rather than rewriting it suppressing it may be better. but I assume rather hard to do.

Also it would be great to be able to work with files other than something.html for example myelement.tpl or myelement.tpl.php

You can rename the file using an export script, or create a copy of it, or if you like do global replacements of "tokens" with PHP equivalents. For example you could sent a text value to:

pvar-myVariable-pvar

Then in the export script replace anything between pvar "tags" to create:

<?php print(myVariable)?>

I'm testing this for embedding Angular within my BSS file and it works very well using a PowerShell script on export to manipulate the contents of the BSS export, the big plus over editing afterwards is I can (hopefully) do all of my editing within BSS and simply "export".