找到模板设置插件tpl_options.php文件中的case 'sort':开头至break;,在break;后面加入代码
case 'sytag':
global $CACHE;
$tag_cache = $CACHE->readCache('tags');
echo '<div class="option-sort-left"><select class="option-sort-select">';
foreach($tag_cache as $value){
echo sprintf('<option value="%s">%s</option>',$value['tagname'],$value['tagname']);
}
echo '</select></div>';
echo '<div class="option-sort-right">';
foreach ($tag_cache as $value) {
$sid = $value['tagname'];
echo '<div class="option-sort-option option-sytag-option">';
if(!isset($option['value'][$sid])){$option['value'][$sid] = $this->getOptionDefaultValue($option, $this->_currentTemplate);}
if($loopValues){if($placeholder){echo sprintf('<input type="hidden" name="%s" value="">', $option['id'] . "[{$sid}]");}
foreach($option['values'] as $value => $label){echo strtr($tpl, array(
'{name}' => $option['id'] . "[{$sid}]",
'{value}' => $this->encode($value),
'{label}' => $label,
'{checked}' => $this->getCheckedString($value, $option['value'][$sid]),
));
}
}else{
echo strtr($tpl, array(
'{name}' => $option['id'] . "[{$sid}]",
'{value}' => $this->encode($option['value'][$sid]),
'{label}' => '',
'{path}' => $this->getImagePath($option['value'][$sid]),
'{rich}' => $this->getRichString($option),
));
}
echo '</div>';
}
echo '</div>';
break;
如果想好看点,加入css文件:
/**舍力加入css开始**/
#tpl-options .depend-sytag{margin-left:0;clear: both;}
.option-sytag-left{ float:left;}
.option-sytag-right{float:left;}
.option-sytag-option input{height:23px;}
/**end**/
使用方法(举例说明):
'tagtt' => array(
'type' => 'text',
'name' => '标签标题设置',
'values' => array('',),
'unsorted' => false,
'depend' => 'sytag',
'description' => '左侧选择标签,然后在输入框中输入标签标题。',
),