简体   繁体   中英

How to add bootstrap to a PHP code?

I've been trying to style a PHP website using bootstrap. Most of the website including things like textbox and select are coded in PHP. How do I add bootstrap to it?

 array("type"=>"select", "name"=>"agentId", "value"=>getAgentASMOption($partyCode), "title"=>"Select Party");

Bootstrap framework is just a library with classes and id's for styling HTML elements.

You can add the required class name in your php array in below manner.

array("type"=>"select", "class"=>"yourclass" , "name"=>"agentId", "value"=>getAgentASMOption($partyCode), "title"=>"Select Party");

Add class attribute as :

array("type"=>"select", "name"=>"agentId", "value"=>getAgentASMOption($partyCode), "title"=>"Select Party","class"=>"myclass");

and then in css

.myclass{
 // your code
}

Add class attribute in your array and css to that class.

array("type"=>"select", "name"=>"agentId", "value"=>getAgentASMOption($partyCode), "title"=>"Select Party", "class"=>"selectClass");

css

.selectClass{
width: 100%;
}

Bootstrap is nothing more than a CSS and JS. You just need to add class/ID in HTML elements. I am assuming that in your PHP code have capabilities to add these things using array keys and values.

 array("type"=>"select", "name"=>"agentId", "value"=>getAgentASMOption($partyCode), "id"=>"fieldID", "class"=>"cssClass", "title"=>"Select Party");

Now you need to define these class in your css files. Make sure you define different values for responsive purpose in media query.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM