First of all, sorry if the solution is somewhere ... I really search during 3 days ... sorry also: I am a newbie in drupal and php.

Because I am not sure the solution I have in mind is the best: let first describe what I want.

Goal

I am a scientist and I proposed to make a new web page for my lab. I want first to create the page people. They are different kinds of 'members' : 'labhead', 'researcher', etc. At the end, I want a web page containing a list like this:

 <h4>Laboratory Head</h4>
Picture - Name - email -  etc. (for the first lab head)
<h4>Research Scientist</h4>
Picture - Name - email -  etc. (for the first scientist)
Picture - Name - email -  etc. (for the second scientist)
<h4>PhD Students</h4>
Picture - Name - email -  etc. (for the first phd student)
 ...

Solution Proposed

  • I create a content type "Lab Member" using the CCK module;
  • I create a container "membertype" with the different categories "labhead", "scientist", etc. by using the category module;
  • I specify that the content type "Lab Member" has to specify a category in "membertype";
  • I create a view "memberview" using the Views module ;
  • To have a nice custom view, I updated the method "phptemplate_views_view_list_memberview" in the file template.php (which I created). I followed the very nice instructions given by Dale McGladdery : http://groups.drupal.org/node/2647.

    By following the method in the above link, I can create a nice custom view with ALL the members of the lab having. The problem is to separate them according to their categories.

    Problem

    I would like to modify the method "phptemplate_views_view_list_memberview" according to:

    <?php
    function phptemplate_views_view_list_memberview($view, $nodes, $type) {
      $output = '<h2>Laboratory Head</h2>';
      $output .= '<br><TABLE ALIGN="center" cellpadding="10" cellspacing="10">';
      $output .= _add_persons_in_position($view, $nodes,'labhead');
      $output .= '</TABLE>';
      $output .= '<h2>Research Scientist</h2>';
      $output .='<br><TABLE ALIGN="center" cellpadding="10" cellspacing="10">';
      $output .= _add_persons_in_position($view, $nodes,'scientist');
      $output .='</TABLE>';
    return $output;
    }
    
    function _add_persons_in_position($view, $nodes,$postype) {
    ....
    }
    

    the problem is to compare the category of each node and to print it only if it matches the desired $postype.

    Thank you for any suggestions (or any turnaround)
    colin