Fork me on GitHub

Set the orderby=dateA by default .. How make this?  Bottom

  • I'm Brazilian and I do not speak English very well...

    I wanted to know if downloads is possible to modify the order for which is shown in CModsDownload 1.9.6...

    I wanted that they were shown oldest first as Default
  • You could do that by calling the module with the sortby parameter in the URL defined as dateA
    For example:

    Code

    /index.php?name=CmodsDownload&file=index&req=viewdownload&cid=1&orderby=dateA


    Alternatively you could hack the module. See file /modules/CmodsDownloads/index.php around line 174. Change:

    Code

    if(!isset($orderby)) {
          $orderby = 0;
          }

    to

    Code

    if(!isset($orderby)) {
          $orderby = 'DateA';
          }


    If this works maybe you could ask the developer to make it a setting in a new version of the module. For that you can just post a message in the forum of the devs

    HTH

    BTW Your English isn't that bad at all icon_wink
  • Thanks for all =D
    But it not works fine =[
    I change the index.php, but the orderby=dateD still set to default..



    Thanks for the compliment ainigma32! XD
  • Sorry, got a bit ahead of myself there..

    There's one other location you should edit: /module/CmodsDownloads/dl-navigation.php line 106.
    Change

    Code

    echo "<td valign=\"top\" width=\"$cmodswidth\" bgcolor=\"#".pnModGetVar('cmodsdownload', 'cmodsbgcolor1')."\" style=\"BORDER-RIGHT: #".pnModGetVar('cmodsdownload', 'cmodsborder2')." 1px solid; BORDER-TOP: #".pnModGetVar('cmodsdownload', 'cmodsborder1')." 1px solid; BORDER-LEFT: #".pnModGetVar('cmodsdownload', 'cmodsborder1')." 1px solid; BORDER-BOTTOM: #".pnModGetVar('cmodsdownload', 'cmodsborder2')." 1px solid\"><table width=\"100%\" border=\"0\" cellspacing=\"0\" cellpadding=\"10\"><tr><td><table width=\"100%\"  border=\"0\"><tr><td><font class=\"pn-normal\"><strong><img src=\"modules/CmodsDownload/images/cat.gif\" border=\"0\" align=\"middle\" alt=\"\"></strong></font></td><td width=\"100%\"><a href=\"".$GLOBALS['modurl']."&amp;req=viewdownload&amp;cid=$cid&amp;orderby=dateD\"><b>".pnVarPrepForDisplay($title)."</b></a> ";

    To

    Code

    echo "<td valign=\"top\" width=\"$cmodswidth\" bgcolor=\"#".pnModGetVar('cmodsdownload', 'cmodsbgcolor1')."\" style=\"BORDER-RIGHT: #".pnModGetVar('cmodsdownload', 'cmodsborder2')." 1px solid; BORDER-TOP: #".pnModGetVar('cmodsdownload', 'cmodsborder1')." 1px solid; BORDER-LEFT: #".pnModGetVar('cmodsdownload', 'cmodsborder1')." 1px solid; BORDER-BOTTOM: #".pnModGetVar('cmodsdownload', 'cmodsborder2')." 1px solid\"><table width=\"100%\" border=\"0\" cellspacing=\"0\" cellpadding=\"10\"><tr><td><table width=\"100%\"  border=\"0\"><tr><td><font class=\"pn-normal\"><strong><img src=\"modules/CmodsDownload/images/cat.gif\" border=\"0\" align=\"middle\" alt=\"\"></strong></font></td><td width=\"100%\"><a href=\"".$GLOBALS['modurl']."&amp;req=viewdownload&amp;cid=$cid&amp;orderby=dateA\"><b>".pnVarPrepForDisplay($title)."</b></a> ";


    That should do the trick icon_smile

    Good luck!
  • Hm.. sorry, but it not works again =[

    I will understand if you not want help me more...

    Thanks for All =D ... !
  • What? Giving up already? icon_wink

    Where do you get the wrong sort order (at the "main" page, in a categorie, in a subcategorie) ?
  • In categorie and subcategorie....


    Thanks for all again =D
    You are help me so much!
    I'll try change something, maybe I get!
    Thanks!
  • I tried some things here, but nothing works...
    If somebody know, please help me..!
    Thanks =]
  • Well I found one more reference to 'DateD' in the source of the module. It's on line 234 of /modules/CmodsDownloads/dl-viewdownload.php. Change

    Code

    if(isset($orderby)) {
            $orderby = convertorderbyin($orderby);
        } else {
            $orderby = convertorderbyin("dateD");
        }

    to

    Code

    if(isset($orderby)) {
            $orderby = convertorderbyin($orderby);
        } else {
            $orderby = convertorderbyin("dateA");
        }


    HTH
  • Now it's working!!!
    But has a little problem... If I click in the diretorie and then I click in the subdiretorie it's work correctly, but if I click directly in the subdiretorie ( before click on diretorie ) not work, it's showed as before...

    Thank so much again! You are really great!
  • Mmmh strange. Will have to look into this later. My offline life is calling icon_wink

    I'll let you know in a day or two.....

    And you're welcome icon_smile
  • \o/\o/ \o/ \o/ \o/
    I found the last reference in the "dl-navigation.php"!

    Here:

    Code

    echo "<td align=\"center\"><img src=\"modules/CmodsDownload/images/bullet_b.gif\" align=\"middle\" alt=\"\"></td><td width=\"100%\"><a class=\"pn-normal\" href=\"".$GLOBALS['modurl']."&amp;req=viewsdownload&amp;sid=$sid&amp;orderby=dateD\">".pnVarPrepForDisplay($stitle)."</a>&nbsp;";


    I change to:

    Code

    echo "<td align=\"center\"><img src=\"modules/CmodsDownload/images/bullet_b.gif\" align=\"middle\" alt=\"\"></td><td width=\"100%\"><a class=\"pn-normal\" href=\"".$GLOBALS['modurl']."&amp;req=viewsdownload&amp;sid=$sid&amp;orderby=dateA\">".pnVarPrepForDisplay($stitle)."</a>&nbsp;";


    Now it's works perfectly!! The dateA is set to default =]
    Thanks a Lot ainigma32, you are helped me so much and taught me somethings =D
    Bye Now! Thanks a lot again =D
  • Allright CrazyAN!

    Thanks for sharing what you found.

    Happy coding icon_smile

This list is based on users active over the last 60 minutes.