is there no way to order nodes other than the default post date?

Comments

nevets’s picture

Use the views module and you can order in a variety of ways.

ggarry’s picture

For 100's of categories? As I never got a answer on how to use $arg in views and the documentation is non existent i will presume it is impossible to do something like /category/$arg and pass $arg onto a filter.

Also if I had a view with a URL category/term1/term2 and nodes in category/term1/term2 wouldn't the category override the view URL?

nevets’s picture

Yes it is possible to pass arguments to views and if you are using the built in taxonomy module you there are existing argument handlers for both "Taxonomy: Term Name" and "Taxonomy: Term ID". As for your second question "nodes in category/term1/term2" would imply the path is handled by something to produce a list (and it makes me think you are using the category module).

ggarry’s picture

No Taxonomy, I should of said vocabulary/term/term . Anyway after searching some more it seems as if it is impossible to sort nodes in a term other than installing a bunch of modules (nodeorder and it's dependencies) and hoping it works, didn't for me. Its seems so simple to just add a ORDER BY t.name in taxonomy.module but

$result = db_query(db_rewrite_sql('SELECT t.tid, t.name FROM {term_data} t WHERE t.tid IN ('. $placeholders .') ORDER BY t.name ASC', 't', 'tid'), $terms['tids']);

doesn't work :/

nevets’s picture

I am confused, are you use the contributed category module or the core taxonomy module. I ask because you snippet shows {term_data} which would imply the core taxonomy module. In the case of the taxonomy module you can use the views module to do want you want.

ggarry’s picture

I use the core taxonomy. I have vocabulary called vehicles and a term call cars and cars/ford . So if you are on the ford page the URL is mysite.com/vehicles/cars/ford (path and pathauto), so if I was to make a view for this I would need to change the url in view in something other than vehicles/cars/ford ? Also like I said if I make a view called vehicles/cars/ford1 and add a filter and I am on that page there is no breadcrumb (no category structure), but if I am on vehicles/cars/ford the breadcrumb is home > vehicles > ford

I would love however if you could tell me how to use $arg? So my URL in views would be vehicles/$arg but how would that get passed onto a filter? I mean if the page was vehicles/ford how would I pass ford on to the filter?

ggarry’s picture

Ok in taxonomy.module

function taxonomy_select_nodes($tids = array(), $operator = 'or', $depth = 0, $pager = TRUE, $order = 'n.sticky DESC, n.created DESC') {

to

function taxonomy_select_nodes($tids = array(), $operator = 'or', $depth = 0, $pager = TRUE, $order = 'n.sticky DESC,n.title ASC,n.created DESC') {

Sorts by title alphabetically.

I still haven't recieved a answer to how to use $arg in views and pass it on to a filter? It seems every one here says it can be done with views, but no one explains how.

selectsplat’s picture

Well, the 'cheap' way to do it would be to just hardcode the term you want it to list alphabetically.

So after this line...

function taxonomy_select_nodes($tids = array(), $operator = 'or', $depth = 0, $pager = TRUE, $order = 'n.sticky DESC, n.created DESC') {

Add this ...

if (arg(2) == 4): //where 4 is the number of the term wehre you want nodes listed alphbetically
$order = 'n.sticky DESC, n.title ASC, n.created DESC';
endif;

baxterjones’s picture

i have the same problem with sorting taxonomy terms alphabetically, where would i add this sorting method?
i have been searching for a solution to this problem for two weeks, so if anybody can help then please post here.