Hello. There are 2 small typos in audio_playlist.theme. I noticed them because they messed up my layout. Probably don't worth a patch though:

function theme_audio_playlist_body($node) {
  global $user;
  $items = $node->audio_playlist_items;
  $image = $node->playlist_info['image_url'] ? '<a href="'.$node->playlist_info['image_url'].'" target="_blank"><img src="'.$node->playlist_info['image_url'].'"></a>' : "";
  $playlist = "\n<ol>\n";
  if (count($items) > 0) {
  foreach ($items as $item) {
    $audio_file = node_load($item);
    $download = $audio_file->audio_fileinfo['downloadable'] ? l("(download)", $audio_file->url_download) : "";
    $playlist .= "<li>". audio_get_player($audio_file) . " ". $audio_file->title ."<small>". l(" (info)", "node/$audio_file->nid") . " ". $download ." </small>" . "</li>\n";
  }
  } else {
    $manage_link = node_access('update', $node, $user->uid) ? l(' <small>[manage '. AUDIO_PLAYLIST_NAME .']</small>', 'node/'. $node->nid .'/manage', array(), null, null, FALSE, TRUE) : '';
    $playlist .= t('No tracks have been added yet. ' . $manage_link);
  }
  $playlist .= "</ol>\n";
  //$playlist = theme('fieldset', array('#value' => $playlist, '#title' => 'Tracklist'));
  $output = "\n<div class=\"audio-playlist-body\">\n";

// Typo in original: <div class="clear" />
// Divs are not self-closing

  $output .= $image .  t('<div class="audio-playlist-listing"><h2>Tracklist:</h2>') . $playlist .'</div><div class="clear">'. $node->body;
  $output .= "</div>\n";

// Forgot to close div.audio-playlist-body
// An extra </div> is needed here

  $output .= "</div>\n";

  return $output;
}

Excellent module, thanks for sharing.

Comments

zirafa’s picture

Hi,

I fixed the div.clear problem...although I don't see the second problem.
Both div.audio-playlist-body and div.audio-playlist-listing have closing divs, so I don't believe an additional one is necessary. You might be overlooking the closing div that is on the same line as <div class="audio-playlist-listing">.

Updated in CVS and HEAD.

zirafa’s picture

Status: Active » Fixed
ditek’s picture

Hi Zirafa,

As far as I see it, the closing div that is on the same line as

actually closes the very same div.audio-playlist-listing.
// Open div.audio-playlist-body
$output = "\n<div class=\"audio-playlist-body\">\n";

// Open and close div.audio-playlist-listing 
$output .= $image . t('<div class="audio-playlist-listing"><h2>Tracklist:</h2>') . $playlist .'</div>

// Open and close div.clear
<div class="clear">'. $node->body;
$output .= "</div>\n";

// Div.audio-playlist-body is still open, therefore it needs to be closed.
$output .= "</div>\n";

return $output;
ditek’s picture

Oops. My HTML got nixed from the text. What I wanted to say was that the div that you mention is actually closing the div.audio-playlist-listings on the very same line.

E.

zirafa’s picture

Right. Isn't that what we want? The idea is that the $image variable actually contains a floating div image, and the listing is floating as well. I fixed it so that the "clear" is not <div class="clear"></div> instead of

. Then on the next line it closes div.audio-playlist-body. I think the difference is I decided to close div.clear, and not wrap $node->body with it. This should work, I believe. It essentially leaves div.clear as an empty element.
// Open div.audio-playlist-body
$output = "\n<div class=\"audio-playlist-body\">\n";

// Open and close div.audio-playlist-listing and div.clear, ($image also contains wrapping DIVs)
$output .= $image . '<div class="audio-playlist-listing"><h2>Tracklist:</h2>' . $playlist .'</div>

// Open and close div.clear
<div class="clear"></div>'. $node->body;

// Div.audio-playlist-body is still open, therefore it needs to be closed.
$output .= "</div>\n";

return $output;
ditek’s picture

Tried it with my layout, it does work.

I often see br class="clear" used in Drupal. It's a few bits less than an empty div...:)

<br class="clear" />
Anonymous’s picture

Status: Fixed » Closed (fixed)