-
AuthorPosts
-
arucardx Friend
arucardx
- Join date:
- July 2010
- Posts:
- 346
- Downloads:
- 0
- Uploads:
- 10
- Thanks:
- 21
- Thanked:
- 138 times in 104 posts
July 19, 2012 at 5:31 am #179235Anyone 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 FriendStork11
- Join date:
- March 2011
- Posts:
- 2273
- Downloads:
- 0
- Uploads:
- 142
- Thanks:
- 55
- Thanked:
- 431 times in 393 posts
July 20, 2012 at 8:18 am #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 Friendarucardx
- Join date:
- July 2010
- Posts:
- 346
- Downloads:
- 0
- Uploads:
- 10
- Thanks:
- 21
- Thanked:
- 138 times in 104 posts
July 20, 2012 at 2:56 pm #461633It 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 FriendStork11
- Join date:
- March 2011
- Posts:
- 2273
- Downloads:
- 0
- Uploads:
- 142
- Thanks:
- 55
- Thanked:
- 431 times in 393 posts
arucardx Friendarucardx
- Join date:
- July 2010
- Posts:
- 346
- Downloads:
- 0
- Uploads:
- 10
- Thanks:
- 21
- Thanked:
- 138 times in 104 posts
July 21, 2012 at 10:01 am #461720Ahh.. 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 Friendarucardx
- Join date:
- July 2010
- Posts:
- 346
- Downloads:
- 0
- Uploads:
- 10
- Thanks:
- 21
- Thanked:
- 138 times in 104 posts
July 30, 2012 at 5:13 am #462534Ok… 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 FriendStork11
- Join date:
- March 2011
- Posts:
- 2273
- Downloads:
- 0
- Uploads:
- 142
- Thanks:
- 55
- Thanked:
- 431 times in 393 posts
July 31, 2012 at 2:32 am #462637Hello 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.
-
AuthorPosts
This topic contains 7 replies, has 2 voices, and was last updated by Stork11 12 years, 4 months ago.
We moved to new unified forum. Please post all new support queries in our New Forum