Just have one quick n00b question. Is there any way to make the theme list in alphabetical order. For example, when you are choosing your own theme, i realized that the themes are in list of the date added, i think, not in alphabetical order. Is there any way to make it happen. Just wondering.
Moderator-edit: subject clarified
Currently, that would take code modification, but it's possible and indeed may be done in the future.
-[Unknown]
How hard or easy would it be? If it is quick and easy, someone might be willing to do it for me if they have time.
Find, Sources/Themes.php:
ksort($context['available_themes']);
Replace:
$temp = array();
foreach ($context['available_themes'] as $theme)
$temp[$theme['name']] = $theme['id'];
ksort($temp);
$temp2 = $context['available_themes'];
$context['available_themes'] = array();
foreach ($temp as $id)
$context['available_themes'][$id] = $temp2[$id];
That should, in theory, do what you want.
-[Unknown]
Unfortunately, for some reason, that doesn't work. When i try the code, this is what i get:
(http://img96.exs.cx/img96/760/theme-not-working.jpg)
However with the original code, this is what i get:
(http://img96.exs.cx/img96/2403/theme-working.jpg)
Modifying sources because you wish the themes be displayed in a different order looks to me like "shooting sparrows with cannons" (as we say in german).
This looks like a much simpler alternative to me:
- delete the known themes from the database by clicking the red "x" in the admin menu
- re-add the known themes into the database with the admin menu option (Install a New Theme - From a directory on the server)
Oops, sorry - I made one big typo that broke it. Try...
Find, Sources/Themes.php:
ksort($context['available_themes']);
Replace:
$temp = array();
foreach ($context['available_themes'] as $theme)
$temp[$theme['name']] = $theme['id'];
ksort($temp);
$temp2 = $context['available_themes'];
$context['available_themes'] = array();
foreach ($temp as $id)
$context['available_themes'][$id] = $temp2[$id];
-[Unknown]
thanx unknown. i will check it out.
yes, that worked. Just one more thing. It really isn't much of a deal for me but i would like to know if you could od something for me. All my themes are in Alphabetical order but i wondering if i could still have my default theme at the top. Like i said before. Really isn't much of a deal but if you could do it, it would be much appreciated. Thanx for all the support you've given me. Still wondering how you became a genius at only nineteen. ???
Again, Sources/Themes.php:
ksort($context['available_themes']);
Replace:
$temp = array();
foreach ($context['available_themes'] as $theme)
$temp[$theme['name']] = $theme['id'];
ksort($temp);
$temp2 = $context['available_themes'];
$context['available_themes'] = array($temp2[0]);
foreach ($temp as $id)
{
if ($id != 0)
$context['available_themes'][$id] = $temp2[$id];
}
That *should* do what you wanted...
-[Unknown]
That is a sweet tweak, especially with 35 themes. :D
Nice and neat now thank you! You the best!
yes. thanx unknown. you are the best
I know that this is a bit old, now...
However, being a relative NooB, I found this worked, brilliantly, with 1.1RC3!
Is there a way of doing the same with the themes as they appear in the admin section?
Is there a way to get 1.1.2 to alphabetize themes?
This really needs to be the default.
Sweet tip! Just helped me out a heck of a lot.
Sorry for pushing this old topic back, but I could only find this one related to the themes order - and this does not work on SMF 2.0.2.
Looking for the same thing here, any ideas?
Seems that there isn't an easy solution or mod available for this basic request. :(
Bump for the awesome [Uknown]. Still works after freaking TEN years with 2.0.9. Unbelievable, I wish you could read me, thanks, after ten years. Should have been into core a LONG while ago.
You just made me post in a topic I hadn't posted in just to say this.
Funny how last time you spoke of Unknown I had to rebuke you for complaining about him.
Also note, at the time that post was made I'm pretty sure Unknown was SMF lead dev... as in, it was left the way it was for a reason.
I know how I spoke about him because I still can't understand something about him, I wish I could talk to him about that since the way I saw it (and still see) looks quite awful.
But still looking at very old topics I saw him supporting everywhere, which makes me not understanding even more, I just commented that the solution was plain epic if it still works after 2.0 and also after 10 years :)
P.s. I would have bet my house you would have been saying exactly what you said ;) I started to understand you, somehow :)
Glad you bumped this ... love the tweak!
That's exactly the reason why I did it, we won't be the only ones, probably :)