Advertisement:

Author Topic: Quick Newb Question / HowTo list the themes in alphabetical order?  (Read 37419 times)

Offline proto-man

  • Semi-Newbie
  • *
  • Posts: 20
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
« Last Edit: November 18, 2004, 12:27:05 AM by andrea »

Offline [Unknown]

  • SMF Friend
  • SMF Master
  • *
  • Posts: 36,102
  • Gender: Male
Re: Quick Newb Question
« Reply #1 on: November 15, 2004, 11:04:11 PM »
Currently, that would take code modification, but it's possible and indeed may be done in the future.

-[Unknown]

Offline proto-man

  • Semi-Newbie
  • *
  • Posts: 20
Re: Quick Newb Question
« Reply #2 on: November 17, 2004, 03:34:44 PM »
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.

Offline [Unknown]

  • SMF Friend
  • SMF Master
  • *
  • Posts: 36,102
  • Gender: Male
Re: Quick Newb Question / HowTo list the themes in alphabetical order?
« Reply #3 on: November 20, 2004, 09:13:24 PM »
Find, Sources/Themes.php:
Code: [Select]
ksort($context['available_themes']);
Replace:
Code: [Select]
$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]
« Last Edit: November 21, 2004, 02:52:08 AM by [Unknown] »

Offline proto-man

  • Semi-Newbie
  • *
  • Posts: 20
Re: Quick Newb Question / HowTo list the themes in alphabetical order?
« Reply #4 on: November 20, 2004, 10:52:54 PM »
Unfortunately, for some reason, that doesn't work. When i try the code, this is what i get:



However with the original code, this is what i get:


Offline andrea

  • SMF Friend
  • SMF Hero
  • *
  • Posts: 4,324
  • Gender: Female
  • I'm a smiley.
    • Smiley Sets
Re: Quick Newb Question / HowTo list the themes in alphabetical order?
« Reply #5 on: November 21, 2004, 01:53:37 AM »
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)
Andrea Hubacher
Ex Lead Support Specialist
www.simplemachines.org

Personal Signature:
Most recent work:
10 Aqua Themes for SMF



Offline [Unknown]

  • SMF Friend
  • SMF Master
  • *
  • Posts: 36,102
  • Gender: Male
Re: Quick Newb Question / HowTo list the themes in alphabetical order?
« Reply #6 on: November 21, 2004, 02:53:10 AM »
Oops, sorry - I made one big typo that broke it.  Try...

Find, Sources/Themes.php:
Code: [Select]
ksort($context['available_themes']);
Replace:
Code: [Select]
$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]

Offline proto-man

  • Semi-Newbie
  • *
  • Posts: 20
Re: Quick Newb Question / HowTo list the themes in alphabetical order?
« Reply #7 on: November 21, 2004, 01:53:23 PM »
thanx unknown. i will check it out.

Offline proto-man

  • Semi-Newbie
  • *
  • Posts: 20
Re: Quick Newb Question / HowTo list the themes in alphabetical order?
« Reply #8 on: November 24, 2004, 10:38:56 PM »
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.  ???

Offline [Unknown]

  • SMF Friend
  • SMF Master
  • *
  • Posts: 36,102
  • Gender: Male
Re: Quick Newb Question / HowTo list the themes in alphabetical order?
« Reply #9 on: November 24, 2004, 11:22:18 PM »
Again, Sources/Themes.php:
Code: [Select]
ksort($context['available_themes']);
Replace:
Code: [Select]
$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]

Offline ViSioNaRy

  • Semi-Newbie
  • *
  • Posts: 58
  • Gender: Male
  • Reach for the stars!
    • DreamQuestor on Facebook
    • DreamQuest Designs
Re: Quick Newb Question / HowTo list the themes in alphabetical order?
« Reply #10 on: November 25, 2004, 02:30:19 AM »
That is a sweet tweak, especially with 35 themes.  :D
Nice and neat now thank you! You the best!
ViSioNaRy   ;D

Offline proto-man

  • Semi-Newbie
  • *
  • Posts: 20
Re: Quick Newb Question / HowTo list the themes in alphabetical order?
« Reply #11 on: November 25, 2004, 05:31:58 PM »
yes. thanx unknown. you are the best

kat

  • Guest
Re: Quick Newb Question / HowTo list the themes in alphabetical order?
« Reply #12 on: August 26, 2006, 04:11:34 PM »
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?

Offline ViSioNaRy

  • Semi-Newbie
  • *
  • Posts: 58
  • Gender: Male
  • Reach for the stars!
    • DreamQuestor on Facebook
    • DreamQuest Designs
Re: Quick Newb Question / HowTo list the themes in alphabetical order?
« Reply #13 on: March 23, 2007, 01:54:02 PM »
Is there a way to get 1.1.2 to alphabetize themes?

This really needs to be the default.
ViSioNaRy   ;D

Offline aerojad

  • Semi-Newbie
  • *
  • Posts: 16
Re: Quick Newb Question / HowTo list the themes in alphabetical order?
« Reply #14 on: August 27, 2007, 04:05:22 AM »
Sweet tip!  Just helped me out a heck of a lot.

Offline dan2507

  • Semi-Newbie
  • *
  • Posts: 10
Re: Quick Newb Question / HowTo list the themes in alphabetical order?
« Reply #15 on: January 31, 2012, 05:04:54 PM »
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.

Offline Home 4 Answers

  • Newbie
  • *
  • Posts: 8
Re: Quick Newb Question / HowTo list the themes in alphabetical order?
« Reply #16 on: February 01, 2012, 01:46:58 AM »
Looking for the same thing here, any ideas?

Offline dan2507

  • Semi-Newbie
  • *
  • Posts: 10
Re: Quick Newb Question / HowTo list the themes in alphabetical order?
« Reply #17 on: February 02, 2012, 02:46:42 PM »
Seems that there isn't an easy solution or mod available for this basic request. :(

Offline Ninja ZX-10RR

  • SMF Hero
  • ******
  • Posts: 2,135
  • Gender: Male
  • Sniper Legends
    • Flavio93Zena on Facebook
    • Virtual Interactive Games Entertainment Forum
Re: Quick Newb Question / HowTo list the themes in alphabetical order?
« Reply #18 on: November 09, 2014, 10:37:30 AM »
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.
Quote from: BeastMode topic=525177.msg3720020#msg3720020
It's so powerful that on this post and even in the two PMs you sent me,you still answered my question very quickly and you're apologizing for the delay. You're the #1 support I've probably ever encountered man, so much respect for that. Thank you, and get better soon.

I'll keep this in my siggy for a while just to remind me that someone appreciated what I did while others didn't.
♥ Jess ♥

STOP EDITING MY PROFILE

Offline Arantor

  • Resident Overthinker
  • SMF Friend
  • SMF Legend
  • *
  • Posts: 68,042
    • Arantor on GitHub
Re: Quick Newb Question / HowTo list the themes in alphabetical order?
« Reply #19 on: November 09, 2014, 10:41:43 AM »
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.
To assume is to hope that those who came before had the presence of mind and capacity to implement the dreams of those who would come after.

You either die a hero or live long enough to see yourself become the villain. It seems you have chosen which, and now I must do the same.