Bootstrap one-page multi-Carousel combined with samrty and bootstrapsamrty
When bootstrap has multiple carousel entries on one page, many people may encounter scenarios where only one carousel can be used, and other carousel entries fail. There are not many materials on the Internet. In fact, this problem may occur because the carousel ID is repeated, which leads to multiple carousel entries on one page of bootstrap.
When I was working on a project, I combined the smarty template to implement scalable configuration carousel and multiple carousel functions on one page.
View layer:
// Test data $ result = '{"service_type": "car", "view": {"picinfo": {"tag_name": "image information", "data ": {"pic_1": {"explain": "Vehicle 1", "type": "text", "options": "", "value ":[".. /.. /.. /web/images/id_card_po ",".. /.. /.. /web/images/borrower_contract ",".. /.. /.. /web/images/car_dashboard "]}," pic_2 ": {" explain ":" Vehicle 2 "," type ":" text "," options ":"", "value ":[".. /.. /.. /web/images/car_dashboard ",".. /.. /.. /web/images/reg_car_info "] }}}'; $ pictures = json_decode ($ result, true); // The array is changed to $ picdata = array (); $ layoutpic = ['picinfo' => [['pic _ 1', 'pic _ 2']; foreach ($ layoutpic as $ key => $ kuai) {$ datakuai = array (); $ temp = $ pictures ['view'] [$ key]; foreach ($ kuai as $ hang) {$ datahang = array (); foreach ($ hang as $ lie) {$ a = $ temp ['data']; $ datahang [$ a [$ lie] ['expln'] = $ a [$ lie] ['value']; // var_dump ($ datahang ); // var_dump ($ a [$ lie] ['value']);} array_push ($ datakuai, $ datahang );} $ picdata [$ temp ['tag _ name'] = $ datakuai;} foreach ($ picdata as $ key => $ value) {foreach ($ value as $ key1 =>$ value1) {}}$ smarty-> assign ("mypicture1", $ value1 );
Tpls template:
{Foreach $ mypicture1 as $ a => B B} <div style = "float: left; display: inline "class =" infoblock mgt ">
Copyright Disclaimer: This article is an original article by the blogger and cannot be reproduced without the permission of the blogger.