Skip to main content
Improved the answer
Source Link
revagomes
  • 648
  • 3
  • 20

The taxonomy module uses the taxonomy_term_page function to build the page that list the nodes attached to a term. But the function that really do the query is the taxonomy_select_nodes that is called by this previous function.

Remember: Never hack core

So you can implement a custom module and use the hook_menu_alter to rewrite the page callback for the taxonomy/term/%taxonomy_term path using a new function based on the taxonomy_term_page to call your custom taxonomy_select_nodes function that perform the changes you need to order the nodes that way.

You'll need to do something like this:

function mymodule_menu_alter(&$items) {
  // Rewrite the taxonmy term page callback
  $items['taxonomy/term/%taxonomy_term']['page callback'] = 'mymodule_taxonomy_term_page';
}

After that you'll have to implement the mymodule_taxonomy_term_page function in order to be able to make the changes you need on the taxonomy_select_nodes() call:

function mymodule_taxonomy_term_page($term) {
  # code...

  if ($nids = mymodule_taxonomy_select_nodes($term->tid)) {
    # code...
  }
  # code...
}

Finally:

function mymodule_taxonomy_select_nodes() {
  # code...
}

You'll must JOIN the node table to build the query in the mymodule_taxonomy_select_nodes function because the taxonomy_index table doesn't have the node title.

Notice that will change the behavior of all taxonomy term pages.

For more info about how to create a custom module see http://drupal.org/node/361112.

The taxonomy module uses the taxonomy_term_page function to build the page that list the nodes attached to a term. But the function that really do the query is the taxonomy_select_nodes that is called by this previous function.

Remember: Never hack core

So you can implement a custom module and use the hook_menu_alter to rewrite the page callback for the taxonomy/term/%taxonomy_term path using a new function based on the taxonomy_term_page to call your custom taxonomy_select_nodes function that perform the changes you need to order the nodes that way.

You'll need to do something like this:

function mymodule_menu_alter(&$items) {
  // Rewrite the taxonmy term page callback
  $items['taxonomy/term/%taxonomy_term']['page callback'] = 'mymodule_taxonomy_term_page';
}

After that you'll have to implement the mymodule_taxonomy_term_page function in order to be able to make the changes you need on the taxonomy_select_nodes() call:

function mymodule_taxonomy_term_page($term) {
  # code...

  if ($nids = mymodule_taxonomy_select_nodes($term->tid)) {
    # code...
  }
  # code...
}

Finally:

function mymodule_taxonomy_select_nodes() {
  # code...
}

Notice that will change the behavior of all taxonomy term pages.

For more info about how to create a custom module see http://drupal.org/node/361112.

The taxonomy module uses the taxonomy_term_page function to build the page that list the nodes attached to a term. But the function that really do the query is the taxonomy_select_nodes that is called by this previous function.

Remember: Never hack core

So you can implement a custom module and use the hook_menu_alter to rewrite the page callback for the taxonomy/term/%taxonomy_term path using a new function based on the taxonomy_term_page to call your custom taxonomy_select_nodes function that perform the changes you need to order the nodes that way.

You'll need to do something like this:

function mymodule_menu_alter(&$items) {
  // Rewrite the taxonmy term page callback
  $items['taxonomy/term/%taxonomy_term']['page callback'] = 'mymodule_taxonomy_term_page';
}

After that you'll have to implement the mymodule_taxonomy_term_page function in order to be able to make the changes you need on the taxonomy_select_nodes() call:

function mymodule_taxonomy_term_page($term) {
  # code...

  if ($nids = mymodule_taxonomy_select_nodes($term->tid)) {
    # code...
  }
  # code...
}

Finally:

function mymodule_taxonomy_select_nodes() {
  # code...
}

You'll must JOIN the node table to build the query in the mymodule_taxonomy_select_nodes function because the taxonomy_index table doesn't have the node title.

Notice that will change the behavior of all taxonomy term pages.

For more info about how to create a custom module see http://drupal.org/node/361112.

Improved the answer
Source Link
revagomes
  • 648
  • 3
  • 20

The taxonomy module uses the taxonomy_term_page function to build the page that list the nodes attached to a term. But the function that really do the query is the taxonomy_select_nodes that is called by this previous function.

Remember: Never hack core

So you can implement a custom module and use the hook_menu_alter to rewrite the page callback for the taxonomy/term/%taxonomy_term path using a new function based on the taxonomy_term_page to call theyour custom taxonomy_select_nodes function passingthat perform the changes you need to order the nodes that way.

You'll need to do something like this:

function hook_menu_altermymodule_menu_alter(&$items) {
  // Rewrite the taxonmy term page callback
  $items['taxonomy/term/%taxonomy_term']['page callback'] = 'mymodule_taxonomy_term_page';
}

After that youyou'll have to implement the mymodule_taxonomy_term_page function in order to be able to make the changes you need on taxonomy_term_pagethe taxonomy_select_nodes() call:

function mymodule_taxonomy_term_page($term) {
  # code...

  if ($nids = mymodule_taxonomy_select_nodes($term->tid, TRUE, array('t.title' => 'ASC'))) {
    # code...
  }
  # code...
}

Finally:

function mymodule_taxonomy_select_nodes() {
  # code...
}

Notice that will change the behavior of all taxonomy term pages.

For more info about how to create a custom module see http://drupal.org/node/361112.

The taxonomy module uses the taxonomy_term_page function to build the page that list the nodes attached to a term. But the function that really do the query is the taxonomy_select_nodes that is called by this previous function.

So you can implement a custom module and use the hook_menu_alter to rewrite the page callback for the taxonomy/term/%taxonomy_term path using a new function based on the taxonomy_term_page to call the taxonomy_select_nodes function passing the changes you need to order the nodes that way.

You'll need to do something like this:

function hook_menu_alter(&$items) {
  // Rewrite the taxonmy term page callback
  $items['taxonomy/term/%taxonomy_term']['page callback'] = 'mymodule_taxonomy_term_page';
}

After that you have to implement the mymodule_taxonomy_term_page function in order to be able to make the changes you need on taxonomy_term_page:

function mymodule_taxonomy_term_page($term) {
  # code...

  if ($nids = mymodule_taxonomy_select_nodes($term->tid, TRUE, array('t.title' => 'ASC'))) {
    # code...
  }
  # code...
}

Notice that will change the behavior of all taxonomy term pages.

For more info about how to create a custom module see http://drupal.org/node/361112.

The taxonomy module uses the taxonomy_term_page function to build the page that list the nodes attached to a term. But the function that really do the query is the taxonomy_select_nodes that is called by this previous function.

Remember: Never hack core

So you can implement a custom module and use the hook_menu_alter to rewrite the page callback for the taxonomy/term/%taxonomy_term path using a new function based on the taxonomy_term_page to call your custom taxonomy_select_nodes function that perform the changes you need to order the nodes that way.

You'll need to do something like this:

function mymodule_menu_alter(&$items) {
  // Rewrite the taxonmy term page callback
  $items['taxonomy/term/%taxonomy_term']['page callback'] = 'mymodule_taxonomy_term_page';
}

After that you'll have to implement the mymodule_taxonomy_term_page function in order to be able to make the changes you need on the taxonomy_select_nodes() call:

function mymodule_taxonomy_term_page($term) {
  # code...

  if ($nids = mymodule_taxonomy_select_nodes($term->tid)) {
    # code...
  }
  # code...
}

Finally:

function mymodule_taxonomy_select_nodes() {
  # code...
}

Notice that will change the behavior of all taxonomy term pages.

For more info about how to create a custom module see http://drupal.org/node/361112.

Improved the answer
Source Link
revagomes
  • 648
  • 3
  • 20

The taxonomy module uses the taxonomy_term_page function to build the page that list the nodes attached to a term. But the function that really do the query is the taxonomy_select_nodes that is called by this previous function.

So you can implement a custom module and use the hook_menu_alter to rewrite the page callback for the taxonomy/term/%taxonomy_term path using a new function based on the taxonomy_term_page to call your second custom function also based on the taxonomy_select_nodes that changesfunction passing the querychanges you need to order the nodes thethat way.

You'll need to do something like this:

function hook_menu_alter(&$items) {
  // Rewrite the taxonmy term page callback
  $items['taxonomy/term/%taxonomy_term']['page callback'] = 'mymodule_taxonomy_term_page';
}

After that you have to implement the mymodule_taxonomy_term_page function in order to be able to make the changes you need. on taxonomy_term_page:

function mymodule_taxonomy_term_page($term) {
  # code...

  if ($nids = mymodule_taxonomy_select_nodes($term->tid, TRUE, array('t.title' => 'ASC'))) {
    # code...
  }
  # code...
}

Notice that will change the behavior of all taxonomy term pages.

For more info about how to create a custom module see http://drupal.org/node/361112.

The taxonomy module uses the taxonomy_term_page function to build the page that list the nodes attached to a term. But the function that really do the query is the taxonomy_select_nodes that is called by this previous function.

So you can implement a custom module and use the hook_menu_alter to rewrite the page callback for the taxonomy/term/%taxonomy_term path using a new function based on the taxonomy_term_page to call your second custom function also based on the taxonomy_select_nodes that changes the query to order the nodes the way you need.

Notice that will change the behavior of all taxonomy term pages.

For more info about how to create a custom module see http://drupal.org/node/361112.

The taxonomy module uses the taxonomy_term_page function to build the page that list the nodes attached to a term. But the function that really do the query is the taxonomy_select_nodes that is called by this previous function.

So you can implement a custom module and use the hook_menu_alter to rewrite the page callback for the taxonomy/term/%taxonomy_term path using a new function based on the taxonomy_term_page to call the taxonomy_select_nodes function passing the changes you need to order the nodes that way.

You'll need to do something like this:

function hook_menu_alter(&$items) {
  // Rewrite the taxonmy term page callback
  $items['taxonomy/term/%taxonomy_term']['page callback'] = 'mymodule_taxonomy_term_page';
}

After that you have to implement the mymodule_taxonomy_term_page function in order to be able to make the changes you need on taxonomy_term_page:

function mymodule_taxonomy_term_page($term) {
  # code...

  if ($nids = mymodule_taxonomy_select_nodes($term->tid, TRUE, array('t.title' => 'ASC'))) {
    # code...
  }
  # code...
}

Notice that will change the behavior of all taxonomy term pages.

For more info about how to create a custom module see http://drupal.org/node/361112.

Source Link
revagomes
  • 648
  • 3
  • 20
Loading