News:

Want to get involved in developing SMF? Why not lend a hand on our GitHub!

Main Menu

Alphabetic Order for Mods ?

Started by edi67, October 25, 2008, 02:23:52 PM

Previous topic - Next topic

edi67

I have over 60 mods installed in my smf 2 beta 4 and is big confusion readin them, there is one way for have them in alphabetic order?

thx
CrazyZone - My SMF Forum


From the difficult the hardening of the man you can see

Nathaniel

At the moment, there is no way to order your installed/downloaded packages/mods. I would also like to see some way of sorting packages. I might have a look into this. ;)

Also, you can see a list of your installed packages in the '/Packages/installed.list' file, you might be able to use that to put them in some sort of alphabetical ordering.
SMF Friend (Former Support Specialist) | SimplePortal Developer
My SMF Mods | SimplePortal

"Quis custodiet ipsos custodes?" - Who will Guard the Guards?

Please don't send me ANY support related PMs. I will just delete them.

[SiNaN]

Subs-Package.php

Find:

return $installed;

Replace:

foreach($installed as $i)
   $sorted[] = $i['name'];

sort($sorted);

foreach($sorted as $s)
foreach($installed as $i)
if($s == $i['name'])
$new[] = $i;

$installed = $new;

return $installed;
Former SMF Core Developer | My Mods | SimplePortal

edi67

Quote from: [SiNaN] on November 06, 2008, 08:04:24 AM
Subs-Package.php

Find:

return $installed;

Replace:

foreach($installed as $i)
   $sorted[] = $i['name'];

sort($sorted);

foreach($sorted as $s)
foreach($installed as $i)
if($s == $i['name'])
$new[] = $i;

$installed = $new;

return $installed;


done but nothing changed :(
CrazyZone - My SMF Forum


From the difficult the hardening of the man you can see

[SiNaN]

Not Package List, check the Installed List.
Former SMF Core Developer | My Mods | SimplePortal

edi67

Quote from: [SiNaN] on November 07, 2008, 07:00:07 AM
Not Package List, check the Installed List.

sorry Sinan, but why my Installed list is Empty ? there is only wrote this 1226047929
CrazyZone - My SMF Forum


From the difficult the hardening of the man you can see

[SiNaN]

I tested before posting it. Can you attach your file here?

And take the change back, it will fix the issue.
Former SMF Core Developer | My Mods | SimplePortal

edi67

Quote from: [SiNaN] on November 07, 2008, 07:29:25 AM
I tested before posting it. Can you attach your file here?

And take the change back, it will fix the issue.

you want my Installed.list file ? sure
CrazyZone - My SMF Forum


From the difficult the hardening of the man you can see

Bulakbol

Try this. Subs-Package.php
Code (find) Select
ORDER BY time_installed DESC',
Code (replace) Select
ORDER BY filename ASC',
Please do not PM me for support · My Mods and Theme · SMF Coding Guidelines · Modifications Approval Guidelines

edi67

Quote from: JohnyB on November 17, 2008, 12:04:52 AM
Try this. Subs-Package.php
Code (find) Select
ORDER BY time_installed DESC',
Code (replace) Select
ORDER BY filename ASC',

thx this work great for INSTALLED PACKAGES , there is one way for do the same with Browse Packages List ?
CrazyZone - My SMF Forum


From the difficult the hardening of the man you can see

ディン1031

#10
So i need a little break from my study, and now i made something that work ;).

This will only work in SMF 2.0.x (I think you've it) ;)

Search in $sourcedir/Package.php for

else
$context['available_other'][] = $packageInfo;
}
closedir($dir);
}

Add after that insert

//Okay this is a way to disable it *g*
if(!empty($_GET['sort']) && $_GET['sort'] == 'none')
{
//Do nothing :D (Or later we can do some other things :P)
}
else
{
//All the arrays that need to be sort :D
$needToBeSorted = array('available_all', 'available_mods', 'available_avatars', 'available_languages', 'available_other');
foreach($needToBeSorted as $itemToSort)
{
//Empty? No Sort need :)
if(empty($context[$itemToSort]))
continue;

//Reset the old Order
$wayToSortThis = array();

foreach($context[$itemToSort] as $key => $packageInfo)
{
$wayToSortThis[$key] = $packageInfo['name'].$packageInfo['version']; //Not the nice way... how should i sort for Versions oO
}
//Okay use the magic mulitsort for this :)
array_multisort($wayToSortThis, $context[$itemToSort]);
}
}


If you like to see the old way again you can add ;sort=none to the package url and it will shown in the old way. ;)

Work only on the browse package list =).

Edit: 19.11.08: I must edit the code, i forgot to clear the sort array.

Bye
DIN1031
Support only via MOD Thread! NO PM Support!
My Forum: ayu][kult Forum
My Mods: My Small Mod Collection
My Parser: DIN1031's ModParser
Current Info: More away the next days, because i've to much work to do :x

Bulakbol

I thought the "Browse Package List" is already alphabetically sorted by package filename but not mod name.
Please do not PM me for support · My Mods and Theme · SMF Coding Guidelines · Modifications Approval Guidelines

ディン1031

Quote from: JohnyB on November 17, 2008, 10:32:06 PM
I thought the "Browse Package List" is already alphabetically sorted by package filename but not mod name.
Yeah i thoght so, too. But it depend on how the unix system output the file list. Normal is the last one the last file. Only under windows the order is in an alphabetic sorted by filenames. But i think there are mods with an other name than the filename so it could be possible on a total diffrent position where you not search it. :)

Bye
DIN1031
Support only via MOD Thread! NO PM Support!
My Forum: ayu][kult Forum
My Mods: My Small Mod Collection
My Parser: DIN1031's ModParser
Current Info: More away the next days, because i've to much work to do :x

edi67

Usually excellent support here thx DIN work like a chamr now ;)
CrazyZone - My SMF Forum


From the difficult the hardening of the man you can see

Costa

Great, this is very usefull ;)

Thank you guys

Farewell
- Costa
Hugo "Costa" Fernandes - PT SMF
Todas as MP's a pedir ajuda são sujeitas a radioactividade, microondas, queimadas e atiradas borda fora.

"At least someone appreciates the fact that I am doing and not thinking..."
"Laziness is counter-revolutionary."

ディン1031

Edit: 19.11.08: I must edit the code, i forgot to clear the sort array.

It's only a small change:

Search for:

foreach($context[$itemToSort] as $key => $packageInfo)


Replace with:

//Reset the old Order
$wayToSortThis = array();

foreach($context[$itemToSort] as $key => $packageInfo)


Bye
DIN1031
Support only via MOD Thread! NO PM Support!
My Forum: ayu][kult Forum
My Mods: My Small Mod Collection
My Parser: DIN1031's ModParser
Current Info: More away the next days, because i've to much work to do :x

Advertisement: