Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/285.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/html/77.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php 如果未选择特征图像,则更改html引导标记_Php_Html_Twitter Bootstrap 3_Joomla_Joomla3.0 - Fatal编程技术网

Php 如果未选择特征图像,则更改html引导标记

Php 如果未选择特征图像,则更改html引导标记,php,html,twitter-bootstrap-3,joomla,joomla3.0,Php,Html,Twitter Bootstrap 3,Joomla,Joomla3.0,我有一个基于Protostar模板的定制Joomla 3引导模板 当前,左侧主内容区标记为: <div class="itemMainContent col-sm-8 col-xs-12"> 如果特征图像未设置/激活,是否有办法将左侧主内容标记改为: <div class="itemMainContent col-xs-12"> 基本上,如果未设置右侧边栏/特色图像,则主要内容区域应为全宽(12列) 主要内容区域和右侧特色图像侧栏的default.php标记摘

我有一个基于Protostar模板的定制Joomla 3引导模板

当前,左侧主内容区标记为:

<div class="itemMainContent col-sm-8 col-xs-12">

如果特征图像未设置/激活,是否有办法将左侧主内容标记改为:

<div class="itemMainContent col-xs-12">

基本上,如果未设置右侧边栏/特色图像,则主要内容区域应为全宽(12列)

主要内容区域和右侧特色图像侧栏的default.php标记摘录如下:

<div class="itemMainContent col-sm-8 col-xs-12">
  <?php
    if (!empty($this->item->pagination) && $this->item->pagination && !$this->item->paginationposition && !$this->item->paginationrelative):
        echo $this->item->pagination;
    endif;
    ?>
    <?php if (isset ($this->item->toc)) :
        echo $this->item->toc;
    endif; ?>
      <?php echo $this->item->text; ?>

        <?php if ($useDefList && ($info == 1 || $info == 2)) : ?>
          <div class="article-info muted">
            <dl class="article-info">
              <dt class="article-info-term"><?php echo JText::_('COM_CONTENT_ARTICLE_INFO'); ?></dt>

              <?php if ($info == 1) : ?>
                <?php if ($params->get('show_author') && !empty($this->item->author )) : ?>
                  <dd class="createdby">
                    <?php $author = $this->item->created_by_alias ? $this->item->created_by_alias : $this->item->author; ?>
                      <?php if (!empty($this->item->contactid) && $params->get('link_author') == true) : ?>
                        <?php
                        $needle = 'index.php?option=com_contact&view=contact&id=' . $this->item->contactid;
                        $menu = JFactory::getApplication()->getMenu();
                        $item = $menu->getItems('link', $needle, true);
                        $cntlink = !empty($item) ? $needle . '&Itemid=' . $item->id : $needle;
                        ?>
                          <?php echo JText::sprintf('COM_CONTENT_WRITTEN_BY', JHtml::_('link', JRoute::_($cntlink), $author)); ?>
                            <?php else: ?>
                              <?php echo JText::sprintf('COM_CONTENT_WRITTEN_BY', $author); ?>
                                <?php endif; ?>
                  </dd>
                  <?php endif; ?>
                    <?php if ($params->get('show_parent_category') && !empty($this->item->parent_slug)) : ?>
                      <dd class="parent-category-name">
                        <?php   $title = $this->escape($this->item->parent_title);
                        $url = '<a href="' . JRoute::_(ContentHelperRoute::getCategoryRoute($this->item->parent_slug)) . '">' . $title . '</a>';?>
                          <?php if ($params->get('link_parent_category') && $this->item->parent_slug) : ?>
                            <?php echo JText::sprintf('COM_CONTENT_PARENT', $url); ?>
                              <?php else : ?>
                                <?php echo JText::sprintf('COM_CONTENT_PARENT', $title); ?>
                                  <?php endif; ?>
                      </dd>
                      <?php endif; ?>
                        <?php if ($params->get('show_category')) : ?>
                          <dd class="category-name">
                            <?php   $title = $this->escape($this->item->category_title);
                        $url = '<a href="' . JRoute::_(ContentHelperRoute::getCategoryRoute($this->item->catslug)) . '">' . $title . '</a>';?>
                              <?php if ($params->get('link_category') && $this->item->catslug) : ?>
                                <?php echo JText::sprintf('COM_CONTENT_CATEGORY', $url); ?>
                                  <?php else : ?>
                                    <?php echo JText::sprintf('COM_CONTENT_CATEGORY', $title); ?>
                                      <?php endif; ?>
                          </dd>
                          <?php endif; ?>
                            <?php if ($params->get('show_publish_date')) : ?>
                              <dd class="published">
                                <span class="icon-calendar"></span>
                                <?php echo JText::sprintf('COM_CONTENT_PUBLISHED_DATE_ON', JHtml::_('date', $this->item->publish_up, JText::_('DATE_FORMAT_LC3'))); ?>
                              </dd>
                              <?php endif; ?>
                                <?php endif; ?>

                                  <?php if ($params->get('show_create_date')) : ?>
                                    <dd class="create">
                                      <span class="icon-calendar"></span>
                                      <?php echo JText::sprintf('COM_CONTENT_CREATED_DATE_ON', JHtml::_('date', $this->item->modified, JText::_('DATE_FORMAT_LC3'))); ?>
                                    </dd>
                                    <?php endif; ?>
                                      <?php if ($params->get('show_modify_date')) : ?>
                                        <dd class="modified">
                                          <span class="icon-calendar"></span>
                                          <?php echo JText::sprintf('COM_CONTENT_LAST_UPDATED', JHtml::_('date', $this->item->modified, JText::_('DATE_FORMAT_LC3'))); ?>
                                        </dd>
                                        <?php endif; ?>
                                          <?php if ($params->get('show_hits')) : ?>
                                            <dd class="hits">
                                              <span class="icon-eye-open"></span>
                                              <?php echo JText::sprintf('COM_CONTENT_ARTICLE_HITS', $this->item->hits); ?>
                                            </dd>
                                            <?php endif; ?>
            </dl>
          </div>
          <?php endif; ?>

            <?php
if (!empty($this->item->pagination) && $this->item->pagination && $this->item->paginationposition && !$this->item->paginationrelative):
    echo $this->item->pagination;
?>
              <?php endif; ?>
                <?php if (isset($urls) && ((!empty($urls->urls_position) && ($urls->urls_position == '1')) || ($params->get('urls_position') == '1'))) : ?>
                  <?php echo $this->loadTemplate('links'); ?>
                    <?php endif; ?>
                      <?php // Optional teaser intro text for guests ?>
                        <?php elseif ($params->get('show_noauth') == true && $user->get('guest')) : ?>
                          <?php echo $this->item->introtext; ?>
                            <?php //Optional link to let them register to see the whole article. ?>
                              <?php if ($params->get('show_readmore') && $this->item->fulltext != null) :
        $link1 = JRoute::_('index.php?option=com_users&view=login');
        $link = new JURI($link1);?>
                                <p class="readmore">
                                  <a href="<?php echo $link; ?>">
                                    <?php $attribs = json_decode($this->item->attribs); ?>
                                      <?php
        if ($attribs->alternative_readmore == null) :
            echo JText::_('COM_CONTENT_REGISTER_TO_READ_MORE');
        elseif ($readmore = $this->item->alternative_readmore) :
            echo $readmore;
            if ($params->get('show_readmore_title', 0) != 0) :
                echo JHtml::_('string.truncate', ($this->item->title), $params->get('readmore_limit'));
            endif;
        elseif ($params->get('show_readmore_title', 0) == 0) :
            echo JText::sprintf('COM_CONTENT_READ_MORE_TITLE');
        else :
            echo JText::_('COM_CONTENT_READ_MORE');
            echo JHtml::_('string.truncate', ($this->item->title), $params->get('readmore_limit'));
        endif; ?>
                                  </a>
                                </p>
                                <?php endif; ?>
                                  <?php endif; ?>
                                    <?php
if (!empty($this->item->pagination) && $this->item->pagination && $this->item->paginationposition && $this->item->paginationrelative) :
    echo $this->item->pagination;
?>
                                      <?php endif; ?>
                                        <?php echo $this->item->event->afterDisplayContent; ?>
</div>
<!--- /itemMainContent --->


<!-- sidebar -->
<?php if ($params->get('access-view')):?>
  <?php if (isset($images->image_fulltext) && !empty($images->image_fulltext)) : ?>
    <?php $imgfloat = (empty($images->float_fulltext)) ? $params->get('float_fulltext') : $images->float_fulltext; ?>
      <div class="pull-<?php echo htmlspecialchars($imgfloat); ?> item-image col-sm-4 col-xs-12"> <img <?php if ($images->image_fulltext_caption): echo 'class="caption"'.' title="' .htmlspecialchars($images->image_fulltext_caption) . '"'; endif; ?> src="
        <?php echo htmlspecialchars($images->image_fulltext); ?>" alt="
          <?php echo htmlspecialchars($images->image_fulltext_alt); ?>"/> </div>
      <?php endif; ?>
        <?php endif; ?>
          <!-- /sidebar -->
          </div>


该图像似乎包含在
$images->image\u fulltext
中,因此您可以使用查看它是否存在

如果图像存在,仅打印类名
col-sm-8

<div class="itemMainContent <?php if (!empty($images->image_fulltext)) echo "col-sm-8" ?> col-xs-12">

图像似乎包含在
$images->image\u fulltext
中,因此您可以使用查看它是否存在

如果图像存在,仅打印类名
col-sm-8

<div class="itemMainContent <?php if (!empty($images->image_fulltext)) echo "col-sm-8" ?> col-xs-12">