Author Topic: Pages in alphabetic order  (Read 598 times)

niek

  • Newbie
  • *
  • Posts: 5
  • Karma: +0/-0
    • View Profile
Pages in alphabetic order
« on: July 25, 2009, 11:25:04 PM »
Hi Xander,

I'm working on a site with more than 25 pages, is there a way to get the pages in alphabetic order in the list to view/change ?

Greetings, Niek

Xander

  • Developer
  • Administrator
  • Full Member
  • *****
  • Posts: 240
  • Karma: +5/-0
    • View Profile
    • CompactCMS.nl
Re: Pages in alphabetic order
« Reply #1 on: July 26, 2009, 03:01:54 PM »
Hi Niek,

Yes it is. Although it is not a configuration variable, you can - without too much hassle - easily change this behavior manually. Open up /admin/index.php and look for the following lines (approx line 50).


// Open recordset for sites' pages
$result
	
	
mysql_query("SELECT * FROM pages ORDER BY `published`, `menu_id`, `toplevel` ASC, `sublevel` ASC"$link);
$total_rows mysql_num_rows($result);


Here you see how the list is ordered. First by publication status, then the menu id, etc. To get it by pagename I suggest you first keep the published, then replace menu_id, toplevel and sublevel by `urlpage` ASC (ascending from A to Z or DESC for Z to A)

Thus:


// Open recordset for sites' pages
$result
	
	
mysql_query("SELECT * FROM pages ORDER BY `published`, `urlpage` ASC"$link);
$total_rows mysql_num_rows($result);


Remember that updating (and replacing the /admin/index.php file) will require you to re-apply this modification. But perhaps it is an interesting idea to make this configurable.

Cheers!
Xander.
Don't ever hold back your suggestions. Help me either to improve CompactCMS or spread the word about it on sites such as Twitter, Digg, StumbleUpon, etc :). Thanks!

niek

  • Newbie
  • *
  • Posts: 5
  • Karma: +0/-0
    • View Profile
Re: Pages in alphabetic order
« Reply #2 on: July 26, 2009, 09:30:39 PM »
Hello Xander,

Thank you verry much,  again you helped me out!
It works perfect !

I'm  working on a school page... so A.B.C....  is nice!