Do not remember me!
/ / / Help customize this module

Help customize this module

Hi,
I've installed this module to my site:
8dle(.)ru/free-modules/4518-top100news-v10.html
Btw as i see it's the top100 for all the time,
How to get the result for each month? ( top 100 monthly )
Thanks! Added by: in MySQL Questions on

No correct answer yet/Unsolve

+2

Comments 8

  1. dlefaq
    +1
    dlefaq Currently Offline → 25 April 2015 12:34

    If you are using DLE 10.x then you can use custom tag
    Top 100 of the month
    {custom category="1-99" days="30" template="custom" aviable="global" from="0" limit="100" order="rating" cache="yes"} 
    
    Top 100 of all time
    {custom category="1-99" template="custom" aviable="global" from="0" limit="100" order="rating" cache="yes"} 

    Reference: http://www.dleguide.com/dle-engine/41-basic-main-tag-and-page-displays.html

    However, the module you link to is not limited to 30 days, the module is using dle api, so maybe the limitation is on api not on module itself
     2 |  102
  2. freshwap
    0
    freshwap Currently Offline → 25 April 2015 13:05

    Hi,
    I see it load from cache:
    $cache = $dle_api->load_from_cache ( "top100views", 3600, $tpl->result['content'] );
    Maybe it will reset when i clear the cache?
     6 |  11
  3. dlefaq
    0
    dlefaq Currently Offline → 25 April 2015 13:24

    That's "cache" it has nothing to do with database query to limit date and time

    The cache function will work to reduce server loading on your site, after "3600" second will be refresh and query to your database again so if new articles changes then it will be refresh and list again...there is nothing to do with your "30 days"...here let me gice you example
    $sql_result = $db->query( "SELECT id, title, category, alt_name, news_read, flag FROM " . PREFIX . "_post WHERE approve=1 ".$category_true." ORDER BY news_read DESC LIMIT ".$top100_config['news_num'] );

    That's default query for this module, there is no limitation...

    If you want limitation then your query should be like this
    $sql_result = $db->query( "SELECT id, title, category, alt_name, news_read, flag FROM " . PREFIX . "_post WHERE approve=1 ".$category_true." AND date >= '$this_month' - INTERVAL 1 MONTH AND date < '$this_month' ORDER BY news_read DESC LIMIT ".$top100_config['news_num'] );


    so it's clear that your module doesn't have limitation
     2 |  102
  4. freshwap
    0
    freshwap Currently Offline → 25 April 2015 14:47

    so i think i just need to edit the sql_result as you suggested?
    thanks!
     6 |  11
  5. freshwap
    0
    freshwap Currently Offline → 25 April 2015 14:52

    well it not work as i think...
    to get top 100 views of the month i think there should be something to reset the view each month, otherwise there will always top views all the time...
     6 |  11
  6. dlefaq
    0
    dlefaq Currently Offline → 25 April 2015 15:23

    top views of the month

    find
    $sql_result = $db->query( "SELECT id, title, category, alt_name, news_read, flag FROM " . PREFIX . "_post WHERE approve=1 ".$category_true." ORDER BY news_read DESC LIMIT ".$top100_config['news_num'] );

    replace with
    $sql_result = $db->query( "SELECT id, title, category, alt_name, news_read, flag FROM " . PREFIX . "_post WHERE approve=1 ".$category_true." AND date >= '$this_month' - INTERVAL 1 MONTH AND date < '$this_month' ORDER BY news_read DESC LIMIT ".$top100_config['news_num'] );

    Top comments of the month

    find
    $sql_result = $db->query( "SELECT id, title, category, alt_name, comm_num, flag FROM " . PREFIX . "_post WHERE approve=1 ".$category_true." ORDER BY comm_num DESC LIMIT ".$top100_config['news_num'] );

    Replace with
    $sql_result = $db->query( "SELECT id, title, category, alt_name, comm_num, flag FROM " . PREFIX . "_post WHERE approve=1 ".$category_true." AND date >= '$this_month' - INTERVAL 1 MONTH AND date < '$this_month' ORDER BY comm_num DESC LIMIT ".$top100_config['news_num'] );

    Top rate of the month

    find
    $sql_result = $db->query( "SELECT id, title, category, alt_name, rating, flag FROM " . PREFIX . "_post WHERE approve=1 ".$category_true." ORDER BY rating DESC LIMIT ".$top100_config['news_num'] );

    replace with
    $sql_result = $db->query( "SELECT id, title, category, alt_name, rating, flag FROM " . PREFIX . "_post WHERE approve=1 ".$category_true." AND date >= '$this_month' - INTERVAL 1 MONTH AND date < '$this_month' ORDER BY rating DESC LIMIT ".$top100_config['news_num'] );


    Like I said before if you want to limit within 30 days you must add month query
     2 |  102
  7. dlefaq
    0
    dlefaq Currently Offline → 25 April 2015 15:26

    in 10.x you just use custom tag and specify days="30" and there is no need for additional queries to database using extra modules and it's very easy to specify and customize, if you want to use as URL you can just use static pages and specify custom tag to display on each static page...you can forget about queries or edit code unless you are absolute good in php and developer
     2 |  102
  8. freshwap
    0
    freshwap Currently Offline → 26 April 2015 00:21

    thanks mate!
     6 |  11

Information

Would you like to leave your comment? Please Login to your account to leave comments. Don't have an account? You can create a free account now.