Gossamer Forum
Home : Products : Gossamer Links : Discussions :

modify_select sort order

Quote Reply
modify_select sort order
How do you change the sort order that the Links display in modify_select.html? It seems sort of random now, would like to make it alphabetical. Is this possible? How?
Quote Reply
Re: [Evoir] modify_select sort order In reply to
Howdie,

Mel gave me this answer:
Quote:
They only way to do this is to actually modify the code, but Alex will
include this in the next version to sort by alphabetical order, so if I
change your code, it will not affect upgrading in the future, just the
current versions. This is what you need to do:

in the file Modify.pm found in admin/Links/User
find the line that starts the subroutine (around line 400):
sub _list_owned_links {

Then inside here, there will be a line:
$link_db->select_options ("LIMIT " . (($nh-1)*$mh) . ",$mh");
(It's about 6 lines down)
replace this with the line:
$link_db->select_options ("ORDER BY Title ASC", "LIMIT " . (($nh-1)*$mh) .
",$mh");
Quote Reply
Re: [Evoir] modify_select sort order In reply to
Hi,

I would like to modify the order with another field.
Would There be another solution?
I would like to avoid of modier the code of the original file.

Thanks!

Mick
Quote Reply
Re: [MJ_] modify_select sort order In reply to
Hi,

It looks like Alex released and update to the code, so that it sorted by Title now, but there still seems to be no option to change a setting, or pass in so=xxx and sb=xxx. You still need to edit the code in /Links/User/Modify.pm to do what you want:

Code:
$link_db->select_options("ORDER BY Title ASC", "LIMIT $limit OFFSET $offset");

..change that to:

Code:
$link_db->select_options("ORDER BY Your_Field ASC", "LIMIT $limit OFFSET $offset");

Cheers

Andy (mod)
andy@ultranerds.co.uk
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package | GLinks ULTRA Package PRO
Links SQL Plugins | Website Design and SEO | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!
Quote Reply
Re: [Andy] modify_select sort order In reply to
Hi,

Is There a solution for to modify the value mh ($limit) by default?

Currently it is 25. But, I would like to obtain 10.

Thanks for your sugestions!

Mick

Quote Reply
Re: [MJ_] modify_select sort order In reply to
Hi,

It looks like $offset etc are created from: (in /Links/User/Modify.pm _list_owned_links() )

Code:
my ($limit, $offset, $nh) = Links::limit_offset();

..so you could try adding this before that line:

Code:
$IN->param( 'mh' => 50 );

...or whatever number you want.

Cheers

Andy (mod)
andy@ultranerds.co.uk
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package | GLinks ULTRA Package PRO
Links SQL Plugins | Website Design and SEO | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!
Quote Reply
Re: [Andy] modify_select sort order In reply to
Hi Andy,

It is perfect!

I have an additional question.
I would like to move a column of my Links table.

I would like to use in SQL Monitor:

Code:
ALTER TABLE MY_TABLE MODIFY COLUMN MY_COLUMN TYPE_OF_MY_COLUMN AFTER OTHER_COLONNE
ALTER TABLE MY_TABLE MODIFY COLUMN MY_COLUMN TYPE_OF_MY_COLUMN FIRST
Do You think that it is possible?

Thanks for your feedback!

Mick
Quote Reply
Re: [MJ_] modify_select sort order In reply to
Hi,

The easiest way to do that, would be using this free plugin :

http://www.gossamer-threads.com/...0v3%20plugin#p308647

I use that quite a bit to change the sort order for fields.

Hope that helps.

Cheers

Andy (mod)
andy@ultranerds.co.uk
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package | GLinks ULTRA Package PRO
Links SQL Plugins | Website Design and SEO | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!
Post deleted by MJ_ In reply to
Quote Reply
Re: [Andy] modify_select sort order In reply to
Hi Andy,

Yes, I thought of using this plugin.
But, I have different data (order) between TableEditor and AdvancedEditor.

Do You have the same order of the columns for TableEditor and AdvancedEditor ?

Thanks,

Mick
Quote Reply
Re: [MJ_] modify_select sort order In reply to
Mmm can't say I've ever noticed. Alternativly, you can edit the field order in phpMyAdmin, and then do a "Re-Sync" of the table, and that *should* re-order them properly for you (be sure to make a backup of your .def file first though!)

Cheers

Andy (mod)
andy@ultranerds.co.uk
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package | GLinks ULTRA Package PRO
Links SQL Plugins | Website Design and SEO | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!