Redirects in Drupal

Module

Redirects mittels title

Mediawiki, Redirects

  • Moving a node in Drupal
  • http://drupal.org/node/378662 How to get node "title" where "nid" is known
  • $sql = 'SELECT title FROM {node} WHERE nid = %d';
    $result = db_query($sql,$mynode);
    $link_title = db_result($result);
  • function get_title_magically($nid)
    {
    $node = node_load(array('nid'=>$nid));
    return $node->title;
    }
  • function get_title_magically($nid) {
      return db_result(db_query('SELECT title FROM {node} WHERE nid = %d',$nid));
    }
  • // Slightly more secure, since it sanitizes the title; not necessary if you're using l().
    function get_title_magically($nid) {
      return check_plain(db_result(db_query('SELECT title FROM {node} WHERE nid = %d',$nid)));
    }
  • // Get titles for published nodes only.
    function get_title_magically($nid) {
      return db_result(db_query('SELECT title FROM {node} WHERE nid = %d AND status = 1',$nid));
    }
  • http://drupal.org/node/2497 Drupal SQL coding conventions
  • the l() function invokes the drupal_lookup_path function:
    l($node->title, ‘node/’.$node->nid)

    which will return an url

Klassifikation