Currently Browsing: drupal

Fix the “No front page content has been created yet.” in Drupal 7 problem

You can hide the “No front page content has been created yet.” in Drupal 7 by adding the following to your local.css:

#first-time {
display: none;
}

buy soap locally

here in santa barbara, ca you can buy soap made locally: http://www.sweetleafessentials.com/

Their website is powered by Drupal too…


Drupal: Sorting by last name given the Title in a link field

preg_match('~([^\s]+)(?:,.*)?$~',$node->field_faculty_link[0]['title'], $match);
$node_field[0]['value'] = $match[0];

Extracting First and Last name from a single field in a drupal content-type

It is possible to extract the first or last name from a single field in a drupal content-type using the computed_field module. Here were my steps, taken from the drupal structure guide :

  1. install computed_field and dependencies
  2. % drush dl computed_field
    Project computed_field (6.x-1.0-beta3) downloaded to      [success]
    /var/www/drupal6/sites/all/modules/computed_field.
    % drush en computed_field
    The following projects will be enabled: computed_field
    Do you really want to continue? (y/n): y
    computed_field was enabled successfully.                  [ok]
  3. edit your content type
  4. add a new ‘Computed’ field
  5. under Global settings, make certain the ‘Computed Field’ is in plain-text mode
  6. for last name
    • // compute last name
      preg_match('~([^\s]+)(?:,.*)?$~',$node->title, $match);
      $node_field[0]['value'] = $match[0];
    • for first name:
      // compute first name
      $node_field[0]['value'] = \
                      substr($node->title, 0, strrpos($node->title, " "));
  7. change data-type to “varchar”
  8. enable/check “Sortable”
  9. Save content-type
  10. Edit your view
  11. Add a ‘Sort Criteria’
  12. Use Content: Computed Last Name (field_computed_lastname)
  13. Click ‘Update’ and then save your view
  14. Navigate to the page where your listing is to see the new sorted version

No-Click Hover Links using Drupal & Nice Menus

I encountered a problem while viewing  a Drupal site with Nice Menus on an Android whereby you could not get to the submenu when clicking on the parent links. On an iPhone a single-tap is taken

1) set URL for parent links that you don’t want to take you anywhere to http://fake.link

2) add the following code to your template.php (at bottom is fine) – note prefix of function name is the template name ${template_name}_menu_item_link()

/* 2010-06-24 randall <>
 taken from http://drupal.org/node/143322#comment-1166563

 */

function zeropoint_menu_item_link($link) {
 if (empty($link['localized_options'])) {
 $link['localized_options'] = array();
 }

 if (!$link['page_callback'] && strpos( $link['href'], 'fake.link')) {
 return '<a href="#">'. $link['title'] .'</a>';
 }
 else {
 return l($link['title'], $link['href'], $link['localized_options']);
 }
}

3) check your navigation bar


« Previous Entries

Powered by WordPress | Designed by Elegant Themes