Is there any way to use db_rewrite_sql to change the "order by" clause of an sql statement?
Thanks,
Dan
On Fri, 24 Jun 2005, Dan Robinson wrote:
Is there any way to use db_rewrite_sql to change the "order by" clause of an sql statement?
Does not seem to be implemented. If you have a use case for this and think you can convince us it is important, send a patch. :)
Cheers, Gerhard
well what we are trying to do is introduce a weighted sort for taxonomy pages - this is useful for websites with a relatively small number of nodes where they want an explicitly ordered display. The weighting part is easy. It would be nice to intercept the sql and rewrite it. Otherwise it seems like the only way to do this is to duplicate the taxonomy display code yada yada. Is this a reasonable approach? Could db_rewrite_sql be jiggered relatively easily?
Dan
On Fri, 24 Jun 2005, Dan Robinson wrote:
Is there any way to use db_rewrite_sql to change the "order by" clause of an sql statement?
Does not seem to be implemented. If you have a use case for this and think you can convince us it is important, send a patch. :)
Cheers, Gerhard
On Fri, 24 Jun 2005, Dan Robinson wrote:
well what we are trying to do is introduce a weighted sort for taxonomy pages - this is useful for websites with a relatively small number of nodes where they want an explicitly ordered display.
Sounds wuite specialized to me.
The weighting part is easy. It would be nice to intercept the sql and rewrite it. Otherwise it seems like the only way to do this is to duplicate the taxonomy display code yada yada.
I think the only thing you'd need to duplicate is the taxonomy_term_page function.
Is this a reasonable approach? Could db_rewrite_sql be jiggered relatively easily?
I think it should be possible to introduce an "order by" element.
Needs some refactoring of db_rewrite_sql and _db_rewrite_sql.
Cheers, Gerhard
FWIW, I think the ability to control the order of items within a taxonomy is extremely useful. I was quite surprised, when I first began working with taxonomies, to discover there was no way to specify the sort (chronological by creation/modification, alphanumeric by title or an arbitrary field) or the order (ascending, descending). I run into this requirement all the time, so it doesn't seem specialized to me.
On Jun 24, 2005, at 1:02 PM, Gerhard Killesreiter wrote:
On Fri, 24 Jun 2005, Dan Robinson wrote:
well what we are trying to do is introduce a weighted sort for taxonomy pages - this is useful for websites with a relatively small number of nodes where they want an explicitly ordered display.
Sounds wuite specialized to me.
The weighting part is easy. It would be nice to intercept the sql and rewrite it. Otherwise it seems like the only way to do this is to duplicate the taxonomy display code yada yada.
I think the only thing you'd need to duplicate is the taxonomy_term_page function.
Is this a reasonable approach? Could db_rewrite_sql be jiggered relatively easily?
I think it should be possible to introduce an "order by" element.
Needs some refactoring of db_rewrite_sql and _db_rewrite_sql.
Cheers, Gerhard -- [ Drupal support list | http://lists.drupal.org/ ]
-- Ken
AIM kendow@mac.com | MSN Me@KenDow.Com | 519-371-6433
Nobody is smart enough to be wrong all the time. - Ken Wilber
ok - thanks for the quick responses - see additional comments below -
On Fri, 24 Jun 2005, Dan Robinson wrote:
well what we are trying to do is introduce a weighted sort for taxonomy pages - this is useful for websites with a relatively small number of nodes where they want an explicitly ordered display.
Sounds wuite specialized to me.
do you think? Maybe my approach is wrong. Take a look at:
http://npc.civicactions.net/prod/about/team
Where there are nodes here that represent "team" members - there could be 6-12. They would be sorted by their importance in the organizational hierarchy, not alphabetically or by order of entry. So I want to be able to set a weight and have it sort correctly. It seems like this pattern is found in many, many websites.
The weighting part is easy. It would be nice to intercept the sql and rewrite it. Otherwise it seems like the only way to do this is to duplicate the taxonomy display code yada yada.
I think the only thing you'd need to duplicate is the taxonomy_term_page function.
but I would have to create an entirely new module correct? There isn't a good way to just "override" the taxonomy_term_page.
Is this a reasonable approach? Could db_rewrite_sql be jiggered relatively easily?
I think it should be possible to introduce an "order by" element.
Needs some refactoring of db_rewrite_sql and _db_rewrite_sql.
ok - thanks for pointing me there - if this approach seems like the right way to do what I want that's where I will start.
Thanks,
Dan
Cheers, Gerhard