活动选项卡时,在li标签中插入span标签

时间:2015-01-07 18:19:59

标签: php html mootools

我有gk5标签扩展程序joomla 当标签处于活动状态时,使用motools插入"激活"像这样的李班:     

    <li data-animation="default" class="gkTab gkTabs-1 active ">
            <span></span>           
    </li>
    <li data-animation="default" class="gkTab gkTabs-2">
            <span></span>           
    </li>

我需要在标签处于活动状态时将html标签插入到li中,如下所示:

  <ol class="gkTabsNav">

    <li data-animation="default" class="gkTab gkTabs-1 active ">
            asdasdsadsad    
    <span class="simple"></span>        
    </li>
    <li data-animation="default" class="gkTab gkTabs-2">
            asdsdasdasdsd           
    </li>

这个地方的PHP源是:

<ol class="gkTabsNav">
        <?php if($this->config['tabs_pre_text'] != '') : ?>
        <li class="gkTabsPreText"><strong><?php echo $this->config['tabs_pre_text']; ?></strong></li>
        <?php endif ; ?>

        <?php for($i = 0; $i < count($this->tabs["title"]); $i++) : ?>
        <?php $active_class = ($this->active_tab == $i + 1) ? ' active' : ''; ?>
        <li<?php if($this->tabs["id"][$i] != '') echo ' id="'.($this->tabs['id'][$i]).'"'; ?> class="gkTab gkTabs-<?php echo ($i+1) . $active_class; ?>" data-animation="<?php echo $this->tabs['animation'][$i]!= '' ? $this->tabs['animation'][$i] : 'default'; ?>">
            <?php if($this->config['tabs_spans'] == '1'): ?><span><?php endif; ?>
                <?php echo $this->tabs["title"][$i]; ?>
            <?php if($this->config['tabs_spans'] == '1'): ?></span><?php endif; ?>
        </li>
        <?php endfor; ?>
 </ol>

2 个答案:

答案 0 :(得分:1)

你去吧 以<li<?php if($this->tabs["id"][$i] != '') echo ' id="'.($this->tabs开头的行的末尾是添加文本的位置,并且此行已添加到此行<?php if($this->config['tabs_spans'] == '1'): ?><span class="arr">

<ol class="gkTabsNav">
        <?php if($this->config['tabs_pre_text'] != '') : ?>
        <li class="gkTabsPreText"><strong><?php echo $this->config['tabs_pre_text']; ?></strong></li>
        <?php endif ; ?>

        <?php for($i = 0; $i < count($this->tabs["title"]); $i++) : ?>
        <?php $active_class = ($this->active_tab == $i + 1) ? ' active' : ''; ?>
        <li<?php if($this->tabs["id"][$i] != '') echo ' id="'.($this->tabs['id'][$i]).'"'; ?> class="gkTab gkTabs-<?php echo ($i+1) . $active_class; ?>" data-animation="<?php echo $this->tabs['animation'][$i]!= '' ? $this->tabs['animation'][$i] : 'default'; ?>">asadasadasadasa
            <?php if($this->config['tabs_spans'] == '1'): ?><span class="arr"><?php endif; ?>
                <?php echo $this->tabs["title"][$i]; ?>
            <?php if($this->config['tabs_spans'] == '1'): ?></span><?php endif; ?>
        </li>
        <?php endfor; ?>
 </ol>

答案 1 :(得分:1)

嗨,对于这个问题,我将span标签插入代码中:

<ol class="gkTabsNav">
        <?php if($this->config['tabs_pre_text'] != '') : ?>
        <li class="gkTabsPreText"><strong><?php echo $this->config['tabs_pre_text']; ?></strong></li>
        <?php endif ; ?>

        <?php for($i = 0; $i < count($this->tabs["title"]); $i++) : ?>
        <?php $active_class = ($this->active_tab == $i + 1) ? ' active' : ''; ?>
        <li<?php if($this->tabs["id"][$i] != '') echo ' id="'.($this->tabs['id'][$i]).'"'; ?> class="gkTab gkTabs-<?php echo ($i+1) . $active_class; ?>" data-animation="<?php echo $this->tabs['animation'][$i]!= '' ? $this->tabs['animation'][$i] : 'default'; ?>">
            <?php if($this->config['tabs_spans'] == '1'): ?><span><?php endif; ?>
                <?php echo $this->tabs["title"][$i]; ?>
            <?php if($this->config['tabs_spans'] == '1'): ?></span><?php endif; ?>
            <span class="simple"></span>
        </li>
        <?php endfor; ?>
    </ol>

而不是在css文件中插入此css:

.gkTabsWrap.horizontal ol li.active .simple {
  background: url("arrow-ama.png") no-repeat scroll 0px 0 rgba(0, 0, 0, 0) !important;
  display: block !important;
  height: 29px;
  position: absolute;
  left: -15px;
  top: 0;
  width: 15px;
}
.simple {
  display: none;

}
相关问题