This should help me theme. What are your thoughts?

I was able to do this in template.php.

function sitetheme_preprocess_page(&$variables) {
  $nodes = $variables['page']['content']['system_main']['nodes'];
  $i = 1;
  $len = count($nodes);
  foreach (array_keys($nodes) as $nid) {
    if ($i == 1) {
      $nodes[$nid]['#node']->classes_array = array('first');
    }
    elseif ($i == $len - 1) {
      $nodes[$nid]['#node']->classes_array = array('last');
    }
    else {
      $nodes[$nid]['#node']->classes_array = array('');
    }
    /* So I don't get "Warning: Cannot use a scalar value as an array" */
    unset($nodes,$nid);
    $i++;
  }
}
function sitetheme_preprocess_node(&$variables) {
  $node = $variables['node'];
  if (!empty($node->classes_array)) {
    $variables['classes_array'] = array_merge($variables['classes_array'], $node->classes_array);
  }
}
Files: 
CommentFileSizeAuthor
#4 zen_add_teaser_classes.patch1.58 KBn8tron

Comments

Well, maybe this is better.

function sitetheme_preprocess_page(&$variables) {
  $nodes = $variables['page']['content']['system_main']['nodes'];
  $i = 1;
  $len = count($nodes);
  foreach (array_keys($nodes) as $nid) {
    if ($i == 1) {
      $variables['page']['content']['system_main']['nodes'][$nid]['#node']->classes_array = array('first');
    }
    if ($i == $len - 1) {
      $variables['page']['content']['system_main']['nodes'][$nid]['#node']->classes_array = array('last');
    }
    $i++;
    /* So I don't get "Warning: Cannot use a scalar value as an array" */
    unset($nodes,$nid);
  }
}

Ok -- check this out. This should help front end folks get the classes they need. Thoughts?

template.php

function sitetheme_preprocess_page(&$variables) {
  if (isset($variables['page']['content']['system_main']['nodes'])) {
    if ($nids = element_children($variables['page']['content']['system_main']['nodes'])) {
      $first_nid = reset($nids);
      $last_nid = end($nids);
      $first_node = $variables['page']['content']['system_main']['nodes'][$first_nid]['#node'];
      $first_node->classes_array = array('first');
      $last_node = $variables['page']['content']['system_main']['nodes'][$last_nid]['#node'];
      $last_node->classes_array = array('last');
    }
  }
}
function sitetheme_preprocess_node(&$variables) {
  $node = $variables['node'];
  if (!empty($node->classes_array)) {
    $variables['classes_array'] = array_merge($variables['classes_array'], $node->classes_array);
  }
}

Status:Active» Needs work

patch, please?

Status:Needs work» Needs review
StatusFileSize
new1.58 KB

Sure John! Patch provided.

Status:Needs review» Needs work

Bah. I just realized this code assumes that the main content block is in the content region.

Maybe you have to attack it from the main content block itself?

Component:PHP Code» layout.css

thanks, that helped me a lot!

Component:layout.css» PHP/JS code

...I really don't know, why it changed that.. :(

Thanks ! Perfect for us. Drupal 7, Zen 7.5.