Open the full view of the article to view the code.
Here is the code for the teaser and breadcrumbs.
Replace the moviereview_view and theme_moviereview_content functions at the end of the file for the following code:
/**
* Implementation of hook_view
*/
function moviereview_view(&$node, $teaser = FALSE, $page = FALSE) {
global $theme;
// Allows themes to override how the review should look like,
// but we cannot depend on the theme() functions, since we
// need to pass the node by reference!
$themefunction = "{$theme}_moviereview_content";
if (!function_exists($themefunction)) {
$themefunction = "theme_moviereview_content";
}
$output = call_user_func($themefunction, $node, $teaser);
if ($page) {
$breadcrumb = array();
$breadcrumb[] = array('path' => 'moviereview', title => t('movie review'));
$breadcrumb[] = array('path' => 'node/'. $node->nid);
menu_set_location($breadcrumb);
}
$node->body .= $output;
$node->teaser .= $output;
// $node = node_prepare($node, $teaser);
}
/**
* Generates the node content
*
* @return string String containing the data
*/
function theme_moviereview_content($node, $teaser = FALSE) {
$output = "<div class=\"moviereview\">\n";
$output .= "<table width=\"100%\">";
$output .= "<tr><td colspan=\"2\"> </td></tr>";
$output .= "<tr><td width=\"15%\" class=\"mr_cover\" align=\"left\" valign=\"top\">";
if($node->cover) {
$output .= " <div class=\"cover\"><img src=\"$node->cover\"></div>\n";
}
$output .= "</td>";
$output .= "<td width=\"85%\" class=\"mr_detail\">";
if($node->movietitle) {
$output .= " <div class=\"label2\">". t("Movie title") .": </div><div class=\"content2\">". $node->movietitle . "</div>";
}
if($node->actors[0]) {
$actors = '';
foreach($node->actors as $actor) {
if($actors != '')
$actors .= ", ";
$actors .= "$actor";
}
$output .= " <div class=\"label2\">". t("Starring") .": </div><div class=\"content2\">". $actors . "</div>";
}
if($node->director) {
$output .= " <div class=\"label2\">". t('Directed by') .": </div><div class=\"content2\">". $node->director ."</div>\n";
}
if($node->writer && !$teaser) {
$output .= " <div class=\"label2\">". t('Written by') .": </div><div class=\"content2\">". $node->writer ."</div>\n";
}
if($node->genre) {
$output .= " <div class=\"label2\">". t('Genre') .": </div><div class=\"content2\">". $node->genre ."</div>\n";
}
if($node->tvseries) {
if ($node->tvseries = 1){
$output .= " <div class=\"label2\">". t('Tv series') .": </div><div class=\"content2\">". t('Yes') ."</div>\n";
}
}
if($node->release) {
$output .= " <div class=\"label2\">". t('Year') .": </div><div class=\"content2\">". $node->release ."</div>\n";
}
if($node->country && !$teaser) {
$output .= " <div class=\"label2\">". t('Country') .": </div><div class=\"content2\">". $node->country ."</div>\n";
}
if($node->language && !$teaser) {
$output .= " <div class=\"label2\">". t('Language') .": </div><div class=\"content2\">". $node->language ."</div>\n";
}
if($node->runtime) {
$output .= " <div class=\"label2\">". t('Runtime') .": </div><div class=\"content2\">". $node->runtime ."</div>\n";
}
if($node->media) {
$output .= " <div class=\"label2\">". t('Media') .": </div><div class=\"content2\">". $node->media ."</div>\n";
}
if($node->imdb && !$teaser) {
$output .= " <div class=\"label2\">". t('Imdb') .": </div><div class=\"content2\">"
. "<a href=\"http://www.imdb.com/title/". $node->imdb ."/\" target=\"_blank\">" . $node->imdb . "</a></div>\n";
}
if($node->rating) {
$output .= " <div class=\"label2\">". t('Rating') .": </div><div class=\"content2\">". $node->rating ."</div>\n";
}
if($node->price && !$teaser) {
$output .= " <div class=\"label2\">". t('Price') .": </div><div class=\"content2\">". $node->price . "</div>\n";
}
$output .= "</td>";
$output .= "</tr>";
$output .= "<tr><td colspan=\"2\"> </td></tr>";
$output .= "</table>";
$output .= " \n"; // end of header
if($node->body) {
$output .= " <div class=\"synopsis\">\n";
$output .= " <span class=\"label4\">". t('Synopsis') ."</span><br />\n";
$output .= " <span class=\"content2\">". check_output($node->body, $node->format) ."</span>\n";
$output .= " </div><br />\n";
}
if($node->location) {
$output .= " <div class=\"location\">\n";
$output .= " <span class=\"label4\">". t('Location') ."</span><br />\n";
$output .= " <span class=\"content2\">". check_output($node->location, $node->format) ."</span>\n";
$output .= " </div><br />\n";
}
if($node->review) {
$output .= " <div class=\"review\">\n";
$output .= " <span class=\"label4\">". t('Review') ."</span><br />\n";
$output .= " <span class=\"content2\">". check_output($node->review, $node->format) ."</span>\n";
$output .= " </div><br />\n";
}
if($node->movielinks[0]) {
$output .= " <div class=\"movielinks\">\n";
$output .= " <span class=\"label4\">". t('Related links') .":</span><br />\n";
$numlinks = count($node->movielinks);
for ($i = 0; $i < $numlinks; $i++) {
$movielink = $node->movielinks[$i];
$linkdescription = $node->linkdescriptions[$i] ? $node->linkdescriptions[$i] : $node->movielinks[$i];
if(ereg('^http://|^https://|ftp://',"$movielink")) {
// off site link
$movielink = "<a href=\"$movielink\">". check_output($linkdescription, $node->format) .'</a>';
}
elseif($movielink) {
// on site link
$movielink = l("$linkdescription", "$movielink");
}
$output .= " <span class=\"content2\">". check_output($movielink, $node->format) ."</span>\n";
}
$output .= " </div>\n";
}
$output .= "</div>\n"; // end of moviereview
return($output);
}
BTW... Mr. Developer, can I make part of the development team? So I can post patches and update the code?
Thanks!
- Sergio
Comments
Comment #1
Emiliano commentedBreadcrumb code commited to module on 2005/11/12.
The teaser stuff still to be revised.
Comment #2
ryooki commentedDoes this fix the teaser function of this module? Right now, my teaser is not a teaser at all, but the same as the full node page.
Comment #3
Emiliano commentedHello!
Nope, I didn't touch teaser stuff.
I just set this issue 'active' as a reminder so that I can review the code asap.
Thanks,
Emiliano.
Comment #4
Emiliano commentedThere's another bug report (37445) about the teaser.