gpt4 book ai didi

php - 动态网站中的 Twitter Bootstrap

转载 作者:行者123 更新时间:2023-11-28 04:37:13 26 4
gpt4 key购买 nike

我应该如何使用像 WordPress 这样的 CMS 生成动态行?

<div class="row-fluid">
<div class="span6"></div>
<div class="span6"></div>
<div class="span6"></div>
<div class="span6"></div>
</div>

那是行不通的。

<div class="row-fluid">
<div class="span6"></div>
<div class="span6"></div>
</div>
<div class="row-fluid">
<div class="span6"></div>
<div class="span6"></div>
</div>

这行得通,但我应该如何对行的后端进行编程?

最佳答案

K.I.S.S es

/**
* Le rows to walk
*/
$rows = array(
"Can",
"I",
"Has",
"Cheezburger",
"?"
);

/**
* Le columns numbers
*/
$columns = 2;
/**
* Le template for each row
*/
$rowTemplate = '<div class="row-fluid">%s</div>';
/**
* Look at that function, yeah, it's a freaking cool function, it will chunk your array.
*/
$chuncked = array_chunk($rows, $columns);
/**
* Foreach for make cool and magical stuffs
*/
foreach($chuncked as $chunk){
$temp = array();
foreach($chunk as $string){
$temp[] = sprintf('<div class="span6">%s</div>', $string);
}
printf($rowTemplate,implode(null, $temp)). PHP_EOL;
}

关于php - 动态网站中的 Twitter Bootstrap ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16427962/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com