Joomla - 检测文章是否具有特色状态

时间:2012-03-30 23:30:08

标签: joomla

如果要呈现的文章也是如此,我如何将自定义class =“featured”添加到html \ com_content \ category \ _blog_item.php中?

是否有一行代码可以确定文章是否有特色?

谢谢!

1 个答案:

答案 0 :(得分:1)

好的,我知道了!

进入html \ com_content \ category \ blog.php

将这一行粘贴在第79行

 <?php 
    $featuredclass = '';
    $item = &$item;
    if ($item->featured == 1) {
        $featuredclass = 'featured';
    } 
?>

并添加

<?php echo $featuredclass;?>
第86行

<div class="items-row cols-<?php echo (int) $this->columns;?> <?php echo 'row-'.$row ; ?>">

所以它看起来像这样:

<?php 
    $featuredclass = '';
    $item = &$item;
    if ($item->featured == 1) {
        $featuredclass = 'featured';
    } 
?>
<div class=" <?php echo $featuredclass;?> items-row cols-<?php echo (int) $this->columns;?>
<?php echo 'row-'.$row ; ?>">

特别感谢Bojcheski