Viewing 7 posts - 1 through 7 (of 7 total)
  • Author
    Posts
  • arucardx Friend
    #179235

    Anyone knows how to add a New icon just like the Hot icon for a newly created K2 article? I remember seeing it before in the Ja Wall demo but now I can’t see that anymore maybe cause the articles there are no longer new lol. Anyway, currently only the Hot icon is working for me but I would like to have a New Icon automatically added to newly created K2 articles.

    The documentation only mention of the Hot button but I’m pretty sure I saw the New button before…

    Stork11 Friend
    #461603

    <em>@arucardx 330737 wrote:</em><blockquote>Anyone knows how to add a New icon just like the Hot icon for a newly created K2 article? I remember seeing it before in the Ja Wall demo but now I can’t see that anymore maybe cause the articles there are no longer new lol. Anyway, currently only the Hot icon is working for me but I would like to have a New Icon automatically added to newly created K2 articles.

    The documentation only mention of the Hot button but I’m pretty sure I saw the New button before…</blockquote>
    Hello arucardx,

    “New” icon is default icon of “Color block” style. It likes “Hot” icon of others style. It’s in “.item-hot .header > h2::before” of “/templates/ja_wall/themes/color_block/css/theme.css” file.

    Regards.

    arucardx Friend
    #461633

    It took me awhile to understand that line of code there lol. For a moment, I was wondering if I could extract the code from color block and reuse it in another style then I realize what you meant haha.

    It’s kinda strange why it’s implemented that way in color block style. Basically every post is New for forever? And only hilite style items have the Hot icon. That seems very wrong @@…

    Stork11 Friend
    #461684

    Hello arucardx,

    Yes, “new” icon is default style. And “hot” icon is featured item style. It’s only used for demo.

    If you’d like to do something more, you must do custom work with it.

    Regards.

    arucardx Friend
    #461720

    Ahh.. demo purpose only. Interesting.

    Thanks for clarifying though, I guess I’ll have to hire someone to get that done. It’s out of my league xD

    arucardx Friend
    #462534

    Ok… so i tired getting someone to do the work but for some reason, she can’t get it done so I decided to attempt it myself but got stuck here, which I hope to get some help from anyone who knows php to shine some light on what I’m writing wrong.

    In order to add a new icon, I would first need to define a variable to get the published date from the K2 article. For that I added this code inside com_k2category_item.php and defined a 2nd variable to add 3 days to that date.
    [PHP]<?php
    $newdate = $this>item>params->get(‘catItemDateCreated’);
    $newdate2 = strtotime(“+3 days”)
    ?>[/PHP]

    Then I added this line next to the code for next icon, so it will display a new icon if it detects that the published date is “smaller” than the new date. More than 3 days, it will not echo, but if its still lesser than 3 days, it will echo and I get my new button to display.
    [PHP]<?php echo $newdate <= $newdate2?’ item-new’:” ?>[/PHP]

    Code looks right to me, that was until I got this error message.
    Parse error: syntax error, unexpected ‘>’ in /templates/ja_wall/html/com_k2/ja_wall/category_item.php on line 85
    Line 85 being [PHP]$newdate = $this>item>params->get(‘catItemDateCreated’);[/PHP]

    What am I doing wrong here? Anyone knows?

    Edit: Looking at the code again, I suddenly realize the logic is off. I’ll need to create a variable that would pull the current date in order for the check to be done properly… I’ll be back to the drawing board… but if anyone can shine some light here, it would be most appreciated.

    Stork11 Friend
    #462637

    Hello arucardx,

    Line 85 must be:
    [PHP]$newdate = $this->item->params->get(‘catItemDateCreated’);[/PHP]

    Your code missed “-” (minus symbol) in front of “>”. Please re-check your code.

    Regards.

Viewing 7 posts - 1 through 7 (of 7 total)

This topic contains 7 replies, has 2 voices, and was last updated by  Stork11 12 years, 3 months ago.

We moved to new unified forum. Please post all new support queries in our New Forum