Viewing 15 posts - 1 through 15 (of 25 total)
  • Author
    Posts
  • obliat Friend
    #173986

    I 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 Friend
    #439183

    hi 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. helper.zip
    obliat Friend
    #457260

    For 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
    Martin

    Sherlock Friend
    #457395

    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 🙂

    obliat Friend
    #457452

    I 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 Friend
    #459145

    If buying a beer will speed it up – then I’m already buying it 😎

    obliat Friend
    #460354

    Won’t lose hope 🙂

    obliat Friend
    #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 Friend
    #463421

    Hi 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 🙂


    1. mod_jabulletin.zip
    obliat Friend
    #463725

    Hi 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.


    1. ja_bulletin
    obliat Friend
    #463736

    I see

    if($ordering !== 'latest' && $params->get('timerange')){
    $model->setState('filter.relative_date', $params->get('timerange'));

    in helper.php

    It 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 Friend
    #463788

    Hi 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 Friend
    #464338

    Yes, I sent PM as it still has the issues I am describing above.

    Sherlock Friend
    #464355

    okay 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 !


    1. helper.zip
    obliat Friend
    #464459

    Hi, 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

Viewing 15 posts - 1 through 15 (of 25 total)

This topic contains 25 replies, has 2 voices, and was last updated by  obliat 12 years, 2 months ago.

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