I want to change the way book pages display such that instead of displaying titles of subsections, they display more like the node_view. I'd like to make it like this:

TITLE
submitted by.....

Blah blah blah body text
--------------------------------------------
* Title - NodeVote score out of # votes
Teaser
(maybe a thumbnail thrown in on the left)

* Title - NodeVote score out of # votes
Teaser
(maybe a thumbnail thrown in on the left)

* Title - NodeVote score out of # votes
Teaser
(maybe a thumbnail thrown in on the left)
-------------------------------------------
previous ---------- up ---------- next

I do not want to do this through categories. Is this possible? I haven't been able to find anything like it.

Thanks!

Comments

midori’s picture

To create your own version of book table of contents, you may need to modify sql statement used to produce the query result returned by function book_tree in book.module.

Instead of returning the result as a list, you may need to return $tree as table and format the query result in function book_tree_recurse. As for thumbnail, you can use CSS to insert the image.

Instead of using book module, you may also need to consider using Article module as well. Good luck.

ryooki’s picture

Thanks for your help. I haven't figured out the pic or the nodevote part yet, but at the teasers are displaying. Here's what I changed in the book.module:

function book_tree_recurse($nid, $depth, $children, $unfold = array()) {
  if ($depth > 0) {
    if ($children[$nid]) {
      foreach ($children[$nid] as $foo => $node) {
        if (in_array($node->nid, $unfold)) {
          if ($tree = book_tree_recurse($node->nid, $depth - 1, $children, $unfold)) {
            $output .= '
			<li class="expanded"><div class="teaserList">';
            $output .= l($node->title, 'node/'. $node->nid);
		$output .= '<div class="teaserText">'.($node->teaser).'</div>';
		$output .= '<ul>'. $tree .'</ul>';
            $output .= '</div></li>';                        }
          else {
            $output .= '
			<li class="leaf"><div class="teaserList">';
            $output .= l($node->title, 'node/'. $node->nid);
		$output .= '<div class="teaserText">'.($node->teaser).'</div>';
            $output .= '</div></li>';

          }
        }
        else {
          if ($tree = book_tree_recurse($node->nid, 1, $children)) {
            $output .= '
			<li class="collapsed"><div class="teaserList">';
            $output .= l($node->title, 'node/'. $node->nid);
		$output .= '<div class="teaserText">'.($node->teaser).'</div>';
            $output .= '</div></li>';
          }
          else {
            $output .= '
			<li class="leaf"><div class="teaserList">';
            $output .= l($node->title, 'node/'. $node->nid);
		$output .= '<div class="teaserText">'.($node->teaser).'</div>';
            $output .= '</div></li>';
          }
        }
      }
    }
  }

  return $output;
}

function book_tree($parent = 0, $depth = 3, $unfold = array()) {
  $result = db_query(db_rewrite_sql('SELECT n.nid, n.title, n.teaser, b.parent, b.weight FROM {node} n INNER JOIN {book} b ON n.nid = b.nid WHERE n.status = 1 AND n.moderate = 0 ORDER BY b.weight, n.title'));

  while ($node = db_fetch_object($result)) {
    $list = $children[$node->parent] ? $children[$node->parent] : array();
    array_push($list, $node);
    $children[$node->parent] = $list;
  }

  if ($tree = book_tree_recurse($parent, $depth, $children, $unfold)) {
    return '<div class="menu"><ul>'. $tree .'</ul></div>';
  }
}

And I added this to the style.css file:
/* Book specific stuff */
.teaserText {
padding: 0px 0px 3px 22px;
}
/***********************/

The only problem now is that for some reason, it's making this section wider than the rest of the page by a 1/4 inch or so. I haven't figured out what's doing it yet, but I'll keep working on it. I know it's only doing this in the Friends Electric theme so far amoung the one's I've tested.

Thanks!
Jennifer
-----
Drupal project page: www.liberalthinkers.org (awaiting flamers)