Гость
16 Дек 2017 10:58

Hello i tried to mark new record with a gif NEW but it does not work Any idea please ? thank you very much for any help

Последние изменения: 25 Янв 2018


pepperstreet VIP
Total posts: 3,837
16 Дек 2017 20:00

Please, can you describe WHAT does not work? Did you check the page source for HTML markup? Did you view the record with another user?


Гость
17 Дек 2017 08:08

thanks i mean i can not manage how to use this feature please


Sergey
Total posts: 13,748
21 Янв 2018 07:09

The parameter to mark articles new, does not mark article. It only add new flag to articl object which you can use in article list template to add badge or nake title bold, or any other style. to access use property $item->new.


Гость
21 Янв 2018 07:24

thankw you wheree i I insert thatt please


pepperstreet VIP
Total posts: 3,837
25 Янв 2018 23:11

Guest where I insert that, please

Sorry, I missed your topic somehow...

I assume you know how to copy and edit custom cobalt templates. It depends on your template file structure and how you want to output the "new" marker. There are many different ways to achieve that. Here are some possible examples:

Choose your list template and make a copy in template manager. For instance the default list template.
Edit it and search for all title outputs:

<?php echo $item->title?>

There should be 2 or 3 occurencies. One for the title index above the list, and usually two regular outputs inside the loop. One has a wrapping link and another one is text only. So insert one of the following solutions near your title.

As Sergey mentioned earlier, $item->new holds the value 1 if it is new.
You can use this information and output it directly to build a class name,
or you can make a condition to output a certain markup of your choice.


Example to output an orange Bootstrap Badge "New":

<?php if($item->new):?>
    <span class="label label-warning">
        <?php echo JText::_('JNEW');?>
    </span>
<?php endif;?>

Example to output an icon from media mint icons folders:

<?php if($item->new):?>
    <?php echo HTMLFormatHelper::icon('new.png');  ?>
<?php endif;?>

Example to output a PNG from Joomla images folder:

<?php if($item->new):?>
    <img src="/PathToImage/new.png" />
<?php endif;?>

Example to change record's H2 title class:
The default template outputs the title with a class="record-title".
Search for it and simply append the PHP to the class name.

class="record-title<?php echo $item->new?>"

Use this new class name in your custom CSS to style it to your liking. You may change the title's color or font. You may add some text through CSS content property and before/after classes etc. Remember to target the link!

.record-title1 a {  
 color: red;
}

BTW, search and hence the "featured" functionality in your template code. It's another example to assign a CSS class name...


Hope this helps. Be creative...

Работает на Cobalt