Hey guys. This is an answer to
this thread. To do this, open up lib/MT/App/CMS.pm and look for the following lines (which should be around line 660 or so):
CODE
if ($type eq 'template') {
$param{object_index_loop} = \@index_data;
$param{object_custom_loop} = \@custom_data;
}
Replace those lines with the below:
CODE
if ($type eq 'template') {
@index_data = sort { $a->{name} cmp $b->{name} } @index_data;
@custom_data = sort { $a->{name} cmp $b->{name} } @custom_data;
for (my $i=0; $i<=$#index_data; $i++) { $index_data[$i]->{is_odd} = $i % 2 ? 0 : 1; }
for (my $i=0; $i<=$#custom_data; $i++) { $custom_data[$i]->{is_odd} = $i % 2 ? 0 : 1; }
$param{object_index_loop} = \@index_data;
$param{object_custom_loop} = \@custom_data;
}
NOTE: These lines may wrap in your browser. There are ONLY SIX LINES between the { } characters. The first two lines start with @. The next two start with "for". The final two lines start with $. Each of the six lines is indented. Make a backup before you do anything weird.
This will sort the templates by the name you've given them. It will sort both your index templates, and your template modules.
For Ben and Mena, this code should replace the {is_odd} determination that happens on lines 640 and 643 in that file. How does this sound?