-
AuthorPosts
-
obliat Friend
obliat
- Join date:
- December 2010
- Posts:
- 416
- Downloads:
- 12
- Uploads:
- 64
- Thanks:
- 108
- Thanked:
- 31 times in 1 posts
February 17, 2012 at 5:51 pm #173986I am trying to do this periodically – with no luck.
My and other lovely Teline IV based websites all lack one vital functionaluty – ability to set Most Read time period (with JA Bulletin module).
Because, how good your website looks when showing Most Read articles from 2010… that everyone has seen and they are of little interest?
So – I use K2 and I beg someone help me modify the code.
In JA Bulletin helper.php – K2MostRead related code is
function getListK2( $params )
{
$type = $params->get ( 'type', 'latest' );
$rows = null;
switch ($type) {
case 'latest' :
$rows = $this->getK2Latest ( $params );
break;
case 'mostread' :
$rows = $this->getK2MostRead ( $params );
break;
}
return $rows;Now in mod_k2_content helper.php for example, code for Most Read (hits), and I guess this is how K2 defines time period for the Most Read, is:
case 'hits':
if ($params->get('popularityRange')){
$datenow = &JFactory::getDate();
$date = $datenow->toMySQL();
$query.=" AND i.created > DATE_SUB('{$date}',INTERVAL ".$params->get('popularityRange')." DAY) ";
}
$orderby = 'i.hits DESC';
break;
But I don’t know how to use K2 example code and modify the JA Bulletin helper.php to show time frame.This is what I’m looking help for.
Sherlock FriendSherlock
- Join date:
- September 2014
- Posts:
- 11453
- Downloads:
- 0
- Uploads:
- 88
- Thanks:
- 221
- Thanked:
- 2478 times in 2162 posts
February 21, 2012 at 4:59 am #439183hi obliat,
you can try as following to add a param of Time range into this module setting
1) open the module xml file modulesmod_jabulletinmod_jabulletin.xml look for this xml tag
<param name=”count” type=”text” default=”5″ label=”Count”
description=”The number of items to display (default is 5)” />
replace it by those tags
<param name=”count” type=”text” default=”5″ label=”Count”
description=”The number of items to display (default is 5)” />
<param
name=”timerange”
type=”list”
default=””
label=”TIME RANGE”
description=”TIME RANGE DESC”>
<option value=””>All time</option>
<option value=”1″>1 day</option>
<option value=”3″>3 days</option>
<option value=”7″>1 week</option>
<option value=”15″>2 weeks</option>
<option value=”30″>1 month</option>
<option value=”180″>6 months</option>
</param>2) replace the file of modulesmod_jabulletinhelper.php by my own modified file (that is attached)
Now you can go to the module back-end to set the Time Range ( it would only work for the most read mode )
1 user says Thank You to Sherlock for this useful post
obliat Friendobliat
- Join date:
- December 2010
- Posts:
- 416
- Downloads:
- 12
- Uploads:
- 64
- Thanks:
- 108
- Thanked:
- 31 times in 1 posts
June 13, 2012 at 2:54 pm #457260For some reasone I don’t receive email notifications on new post and I missed that precious post.
First of all I do thank you very much and I only have one question: I think I posted this when my Teline IV based website was still J1.5
So are these changes you made applicable to J2.5 version or addition mods will need to be made.
Best Regards
MartinSherlock FriendSherlock
- Join date:
- September 2014
- Posts:
- 11453
- Downloads:
- 0
- Uploads:
- 88
- Thanks:
- 221
- Thanked:
- 2478 times in 2162 posts
June 14, 2012 at 10:11 am #457395Hi obliat,
I created an issue into the Ja bug tracking system here for Ja developers to check and they might need to add this feature into the module setting, you can also follow that issue to know when it get fixed, once it’s done I will post the solution here 🙂
1 user says Thank You to Sherlock for this useful post
obliat Friendobliat
- Join date:
- December 2010
- Posts:
- 416
- Downloads:
- 12
- Uploads:
- 64
- Thanks:
- 108
- Thanked:
- 31 times in 1 posts
June 14, 2012 at 6:40 pm #457452I will say that this will be a milestone! Teline IV is a News Template and having time frame option is a must that will make the template accomplished. Everyone wants fresh news and by having this feature Teline IV will have this great feature.
I will of course follow the development process closely.
T H A N K Y O U!!!
obliat Friendobliat
- Join date:
- December 2010
- Posts:
- 416
- Downloads:
- 12
- Uploads:
- 64
- Thanks:
- 108
- Thanked:
- 31 times in 1 posts
June 28, 2012 at 6:13 am #459145If buying a beer will speed it up – then I’m already buying it 😎
obliat Friendobliat
- Join date:
- December 2010
- Posts:
- 416
- Downloads:
- 12
- Uploads:
- 64
- Thanks:
- 108
- Thanked:
- 31 times in 1 posts
July 9, 2012 at 2:26 pm #460354Won’t lose hope 🙂
obliat Friendobliat
- Join date:
- December 2010
- Posts:
- 416
- Downloads:
- 12
- Uploads:
- 64
- Thanks:
- 108
- Thanked:
- 31 times in 1 posts
August 6, 2012 at 8:02 am #463320<em>@Sherlock Holmes 325359 wrote:</em><blockquote>Hi obliat,
I created an issue into the Ja bug tracking system here for Ja developers to check and they might need to add this feature into the module setting, you can also follow that issue to know when it get fixed, once it’s done I will post the solution here :)</blockquote>
I can’t follow the link anymore :((
And I don’t know if there’s an update to this. Please let me know guys
Sherlock FriendSherlock
- Join date:
- September 2014
- Posts:
- 11453
- Downloads:
- 0
- Uploads:
- 88
- Thanks:
- 221
- Thanked:
- 2478 times in 2162 posts
August 7, 2012 at 3:33 am #463421Hi obliat,
Sorry for this long delay, I attached here a module package that has been added the field of timerange, you can replace it with your own module and let me know if it work well 🙂
obliat Friendobliat
- Join date:
- December 2010
- Posts:
- 416
- Downloads:
- 12
- Uploads:
- 64
- Thanks:
- 108
- Thanked:
- 31 times in 1 posts
August 9, 2012 at 8:17 am #463725Hi Sherlock and thanks a lot for the update.
I installed the new version. What happens now is I have time range to choose, I picked up 1 month and the result is that the Most read tab of the module still shows my oldest K2 Items (not those from the last month), but with some issues. Some of them now have a smiley instead thumbnail, and the date is incorrect (not like in the actual item). So in the attached picture you see the marked item shows 2012 date, but it’s made in April 2011. (Cache cleared, you know all that stuff, so not a cache issue)
It’s kind of like the code now tries to filter by date, but there’s some mess with the dates I guess. If you need access to my website jst let me know. Thanks again and really looking forward to your resolution guys. It will be amazing to have this working.
obliat Friendobliat
- Join date:
- December 2010
- Posts:
- 416
- Downloads:
- 12
- Uploads:
- 64
- Thanks:
- 108
- Thanked:
- 31 times in 1 posts
August 9, 2012 at 9:30 am #463736I see
if($ordering !== 'latest' && $params->get('timerange')){
$model->setState('filter.relative_date', $params->get('timerange'));
in helper.phpIt only has ‘latest’ class, but no ‘most read’. Could it be this is where it needs some attention and probably K2 specific instruction :-[
And even if Timerange is set to All times – e.g. not setting time range – it still shows smileys on some ot the items instead of thumbs and dates are wrong – so the new module code kind of messes it all up
Sherlock FriendSherlock
- Join date:
- September 2014
- Posts:
- 11453
- Downloads:
- 0
- Uploads:
- 88
- Thanks:
- 221
- Thanked:
- 2478 times in 2162 posts
August 10, 2012 at 2:01 am #463788Hi obliat,
Is the time range function still not working ? Had you updated the old module? you can pm me the url, admin account and the FTP Info for further checking !
obliat Friendobliat
- Join date:
- December 2010
- Posts:
- 416
- Downloads:
- 12
- Uploads:
- 64
- Thanks:
- 108
- Thanked:
- 31 times in 1 posts
August 15, 2012 at 9:23 pm #464338Yes, I sent PM as it still has the issues I am describing above.
Sherlock FriendSherlock
- Join date:
- September 2014
- Posts:
- 11453
- Downloads:
- 0
- Uploads:
- 88
- Thanks:
- 221
- Thanked:
- 2478 times in 2162 posts
August 16, 2012 at 2:39 am #464355okay obliat, I checked again one more time and found that it’s my mistake 🙁 , I attached here a helper.php file that you can replace with your own file modulesmod_jabulletinhelper.php, in that new file I have added these new code
[PHP]
if($ordering == “mostread” && $params->get(‘timerange’)){
$datenow = JFactory::getDate();
$date = $datenow->toMySQL();
$query.=” AND i.created > DATE_SUB(‘{$date}’,INTERVAL “.$params->get(‘timerange’).” DAY) “;}[/PHP]
I hope it should help !
obliat Friendobliat
- Join date:
- December 2010
- Posts:
- 416
- Downloads:
- 12
- Uploads:
- 64
- Thanks:
- 108
- Thanked:
- 31 times in 1 posts
August 16, 2012 at 7:46 pm #464459Hi, thanks for your efforts.
This new code doesn’t change it and it still shows old articles (K2 items) in the Most Read section of the module (which is actually tabs1) no matter I set 1 month (for example) timeframe. And like before, some of the thumbnails are replaced by smileys. It’s not looking good, but I’ll leave it so you take a look at col_masss_bot (sidebar) position at http://www.ecars.bg
Martin
AuthorPostsThis topic contains 25 replies, has 2 voices, and was last updated by obliat 12 years, 3 months ago.
We moved to new unified forum. Please post all new support queries in our New Forum