本文整理汇总了PHP中FusionHelper::generate_column_combinations方法的典型用法代码示例。如果您正苦于以下问题:PHP FusionHelper::generate_column_combinations方法的具体用法?PHP FusionHelper::generate_column_combinations怎么用?PHP FusionHelper::generate_column_combinations使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FusionHelper
的用法示例。
在下文中一共展示了FusionHelper::generate_column_combinations方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: get_custom_templates
/**
* Function to get tab content for custom templates
*
* @since 2.0.0
*
* @return String String having tab content
*/
public function get_custom_templates()
{
$columns = 6;
//number of columns
$content = '<div id="custom_templates_wrapper">
<div id="custom_templates_left">
<h1 class="templates_heading">' . __('Save Template', 'fusion-core') . '</h1>
<div class="save_templates_here">
<a class="templates_selection" id="fusion_save_custom_tpl"
href="JavaScript:void(0)">' . __('Save Layout As Template', 'fusion-core') . '</a>
</div>
</div>
<div id="custom_templates_right">
<h1 class="templates_heading">' . __('Load Template', 'fusion-core') . '</h1>';
//get templates data
$templates = get_option('fusion_custom_templates');
//if value exists and there are more than 1 number of templates
if ($templates != false && count($templates) > 0) {
//generate column combinations
$combinations = FusionHelper::generate_column_combinations(count($templates), $columns);
//add data in each column
for ($i = 0; $i < $columns; $i++) {
//if no data available for this column then break
if ($combinations[$i] == 0) {
break;
}
$counter = 0;
$content .= ' <div class="custom_templates_sections">';
foreach ($templates as $key => $value) {
$content .= ' <div style="position:relative;" class="template_selection_wrapper"> ';
$content .= ' <div class="hidden_overlay">
<a href="JavaScript:void(0)" data-id="' . $key . '" class="fuiosn_load_template">' . __('LOAD', 'fusion-core') . '</a>
<a href="JavaScript:void(0)" data-id="' . $key . '" class="fusion_delete_template">' . __('DELETE', 'fusion-core') . '</a>
</div>';
$content .= ' <a class="fusion_custom_template templates_selection" href="JavaScript:void(0)">' . $key . '</a>';
$content .= ' </div>';
//remove current element from array for next iteration
unset($templates[$key]);
$counter++;
//if reached combination value then break loop
if ($counter == $combinations[$i]) {
break;
}
}
$content .= '</div>';
}
}
$content .= '</div>';
return $content;
}
示例2: get_prebuilt_templates
/**
* Function to get tab content for pre-built templates
*
* @since 2.0.0
*
* @return String String having tab content
*/
public function get_prebuilt_templates()
{
$columns = 6;
//number of columns
$content = '<div id="pre_built_templates_wrapper"><div id="custom_templates_right" class="custom_pre_built">';
//get templates data
$templates = unserialize(base64_decode(self::$content));
//if value exists and there are more than 1 number of templates
if ($templates != false && count($templates) > 0) {
//generate column combinations
$combinations = FusionHelper::generate_column_combinations(count($templates), $columns);
//add data in each column
for ($i = 0; $i < $columns; $i++) {
//if no data available for this column then break
if ($combinations[$i] == 0) {
break;
}
$counter = 0;
$content .= ' <div class="pre_built_templates_section">';
foreach ($templates as $key => $value) {
$content .= ' <div class="template_selection_wrapper"> ';
$content .= ' <a class="fusion_pre_built_template templates_selection" data-id="' . $key . '" ';
$content .= ' href="JavaScript:void(0)">' . $key . '</a>';
$content .= ' </div>';
//remove current element from array for next iteration
unset($templates[$key]);
$counter++;
//if reached combination value then break loop
if ($counter == $combinations[$i]) {
break;
}
}
$content .= '</div>';
}
}
$content .= '</div></div>';
return $content;
}