- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
这是我的第一篇文章,但我过去经常使用这个网站。我是一个 php 新手,但我对 bootstrap、html、css 和 Joomla 很着迷。
我在 Joomla 中使用 K2,我需要更改 K2 类别项目布局(此处示例:www.caravanningoz.com.au/news)
目前,我将图像设置为左侧的 bootstrap 3 col-md-5,然后图像右侧的介绍文本设置为 col-md-7。
我遇到的问题(我相信很多人已经知道)是如果没有上传图片,那么左边应该有图片的地方会有一个很大的空白区域。
我希望能够使用一些 php 代码来表示“如果没有图像,则设置删除图像 col-md-5 并制作 introtext col-md-12(因此它适合整个列) .
这里是 k2 类别项目布局 php 文件中的大部分代码:
<div class="row">
<div class="catItemView group<?php echo ucfirst($this->item->itemGroup); ?><?php echo ($this->item->featured) ? ' catItemIsFeatured' : ''; ?><?php if($this->item->params->get('pageclass_sfx')) echo ' '.$this->item->params->get('pageclass_sfx'); ?>">
<div class="catItemImage left col-md-5 col-sm-5">
<?php if($this->item->params->get('catItemImage') && !empty($this->item->image)): ?>
<!-- Item Image -->
<a class="categoryItemImage" href="<?php echo $this->item->link; ?>" title="<?php if(!empty($this->item->image_caption)) echo K2HelperUtilities::cleanHtml($this->item->image_caption); else echo K2HelperUtilities::cleanHtml($this->item->title); ?>">
<div class=" grow-up drop-shadow">
<img class="img-responsive caption" src="<?php echo $this->item->image; ?>" alt="<?php if(!empty($this->item->image_caption)) echo K2HelperUtilities::cleanHtml($this->item->image_caption); else echo K2HelperUtilities::cleanHtml($this->item->title); ?>" style="width:<?php echo $this->item->imageWidth; ?>px; height:auto;" />
</div>
</a>
<?php endif; ?>
</div>
<div class="catItemContent right col-md-7 col-sm-7">
<!-- Plugins: BeforeDisplay -->
<?php echo $this->item->event->BeforeDisplay; ?>
<!-- K2 Plugins: K2BeforeDisplay -->
<?php echo $this->item->event->K2BeforeDisplay; ?>
<?php if($this->item->params->get('catItemTitle')): ?>
<!-- Item title -->
<h3 class="catItemTitle">
<?php if(isset($this->item->editLink)): ?>
<!-- Item edit link -->
<span class="catItemEditLink">
<a class="modal" rel="{handler:'iframe',size:{x:990,y:550}}" href="<?php echo $this->item->editLink; ?>">
<?php echo JText::_('K2_EDIT_ITEM'); ?>
</a>
</span>
<?php endif; ?>
<?php if ($this->item->params->get('catItemTitleLinked')): ?>
<a href="<?php echo $this->item->link; ?>">
<?php echo $this->item->title; ?>
</a>
<?php else: ?>
<?php echo $this->item->title; ?>
<?php endif; ?>
<?php if($this->item->params->get('catItemFeaturedNotice') && $this->item->featured): ?>
<!-- Featured flag -->
<span>
<sup>
<?php echo JText::_('K2_FEATURED'); ?>
</sup>
</span>
<?php endif; ?>
</h3>
<?php endif; ?>
<?php if($this->item->params->get('catItemAuthor')): ?>
<!-- Item Author -->
<span class="catItemAuthor">
<?php echo K2HelperUtilities::writtenBy($this->item->author->profile->gender); ?>
<?php if(isset($this->item->author->link) && $this->item->author->link): ?>
<a rel="author" href="<?php echo $this->item->author->link; ?>"><?php echo $this->item->author->name; ?></a>
<?php else: ?>
<?php echo $this->item->author->name; ?>
<?php endif; ?>
</span>
<?php endif; ?>
<div class="clr"></div>
<div>
<?php if($this->item->params->get('catItemDateCreated')): ?>
<!-- Date created -->
<span class="catItemDateCreated">
<?php echo JHTML::_('date', $this->item->created , JText::_('DATE_FORMAT_LC3')); ?>
</span>
<?php endif; ?>
<?php if($this->item->params->get('catItemCategory')): ?>
<!-- Item category name -->
<span class="catItemCategory">
<span><?php echo JText::_('K2_PUBLISHED_IN'); ?></span>
<a href="<?php echo $this->item->category->link; ?>"><?php echo $this->item->category->name; ?></a>
</span>
<?php endif; ?>
</div>
最佳答案
将其放在您发布的脚本的顶部:
<?php
if(!empty($this->item->image)) {
$class = "col-md-5 col-sm-5";
} else {
$class = "col-md-12 col-sm-12";
}
?>
现在您可以使用 $class
代替“col-md-7 col-sm-7”。
关于twitter-bootstrap - php 如果没有图像使 Bootstrap 列 col-md-12,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25871206/
我想在 md-toolbar 中使用 mf-tabs,我使用 Sithdown 在 https://github.com/angular/material/issues/1076 中提供的解决方案 它
我是新手,我设法用服务提供的数据实现了我的 md-table。现在我正在尝试实现过滤器、排序和分页功能,但我认为我做错了什么。 这是我的组件: import { Component, OnInit,
我必须打开一个 md-dialog,其中包含一个带有两个选项卡的 md-tab-group。 md-dialog 可以从两个按钮打开,这两个按钮应该打开相应的选项卡。打开 md-dialog 的模板:
我正在尝试做这样的事情: {{item}}
我正在尝试使用 md-datepicker 遍历一个月的时间间隔,因此我创建了这个 codepen 示例以便更好地演示: http://codepen.io/anon/pen/ygBGOg 当单击“P
这是关于 Codepen 的例子. 我正在设置 md-row-height="30px" 然后计算 md-rowspan 使其等于元素数 + 1。(头部加一) {{ t
当我频繁切换 md-tabs 时,Md-tabs 切换正确但多个 md-tab-item 元素同时具有“md-active”类,所以我看不到选项卡的内容是事件的,因为它与其右侧选项卡的内容重叠。 据我
我想将操作放在同一数据行上,我有两个操作,为此我使用按钮和图标作为下面的代码。 {{item.codigo}} {{it
在我的对象列表中,我可以激活/非事件对象。因此,一个图标执行事件操作,另一个图标执行非事件操作,并且两者都在同一个 md-list 中。 This is what i'm tring to do 代码
如前所述 Angular-Material md-autocomplete's documentation : The md-autocomplete uses the the md-virtual-
我也在使用 Angular 1 和 Angular Material 。我想在 ng-repeat 中使用 md-subheader 和多个 md-virtual-repeat-container。您
我正在使用 Angular Material 。 当我创建自己的指令并将其添加到 md-tab-label 时,例如 Label 然后自定义指令也应用于一些“md-dummy-tab”。 但是
我在我的项目中使用 Angular Material 有一段时间了。在使用 md-select 时,我遇到了一个问题,即出现重复的 md-option 值错误。 我知道 md-options 采用唯一
我正在根据单选按钮选择设置自动完成验证 md-require-match = true/false。 默认验证是 md-require-match = true 这样用户应该从自动完成列表中选择一个项
这个问题在这里已经有了答案: Changing capitalization of filenames in Git (11 个答案) 关闭 3 年前。 我使用“readme.md”创建了我的存储库
Github有办法吗?在例如 README.md 中包含 md 文件? # Headline Text [include](File:load_another_md_file_here.md) 它不应
我正在使用 AngularJs 开发这个动态过滤系统,并试图找出如何将 color 和 size 选项转换为在两个下拉列表中(每个类别一个)。 我尝试了以下代码,该代码成功添加了下拉列表以及选择框中的
var app = angular.module('tabsDemo', ['ngMaterial']); app.controller('TabsController',tabsController
在 md-tab 指令内嵌套 md-select 和搜索输入时遇到问题。 有两个问题: 选择框展开后,必须向上滚动才能查看搜索输入 搜索输入实际上不接受任何文本 我做了一个codepen为了更好地说明
我正在尝试处理这个片段,其中自动完成功能嵌入在芯片中。但从自动完成中选择的项目不会转换为筹码。 自动完成的数据采用以下方式:{name:"John Doe", id:"1"} 哪里错了,请指教。 问候
我是一名优秀的程序员,十分优秀!