Hi guys. I've tried experimenting for days but I'm simply pretty clueless on this and quite a bit more:
Regarding the following code (from a module), how would I add a css class to one of the fields (which will be output as a link)?
Specifically, I would want the $reselect item (or any item at that) to have a class/id of say 'mycssclass'.

  foreach($resume_list as $resume) {
    $reselect  = l(t($resume['title']),  'node/' . $resume['nid']);
    $apply = l(t('Apply using this CV'), "job/apply/$job_nid/$resume_nid" . $resume['nid']);

    $rows[] = array(
      $reselect,
      format_interval(time() - $resume['changed']), 
      $apply
      );
  }
  $headers = array(t('Resume Title'), t('Last Changed'), t('Operations'));

  $output .= theme('table', $headers, $rows);

  print theme('page', $output); 
 
}

In essence, how does one add, classes, divs etc inside code.
I'm in too deep but some guidance would help a long way.

Comments

nevets’s picture

For your specific question

$reselect  = l(t($resume['title']),  'node/' . $resume['nid'], array('attributes' => array('class' =>'your-class-here'))));

As for your more general question, many (but not all) theme functions can take the attributes array. For adding html elements (ex: div tag) you can implement templates though the answers does depend a bit on the details.

kenyan’s picture

Thank you so much nevets.
I've been searching for this for days and I believe the reason I could not find anything that did not reference other modules was typing in the wrong words in search.
Got an idea where I could find bulk documentation on this kind of 'stuff'. Anything that would be helpful for gaining the knowledge.

nevets’s picture

The starting point is the Theming Guide. For specific functions you can look them up at api.drupal.org