tripal_pub_teaser.tpl.php

  1. 2.x tripal_pub/theme/templates/tripal_pub_teaser.tpl.php
  2. 3.x legacy/tripal_pub/theme/templates/tripal_pub_teaser.tpl.php
1 theme call to tripal_pub_teaser.tpl.php
tripal_pub_node_view in tripal_pub/includes/tripal_pub.chado_node.inc
Implements hook_node_view(). Acts on all content types.

File

tripal_pub/theme/templates/tripal_pub_teaser.tpl.php
View source
  1. <?php
  2. $node = $variables['node'];
  3. $pub = $variables['node']->pub;
  4. // get the citation
  5. $values = array(
  6. 'pub_id' => $pub->pub_id,
  7. 'type_id' => array(
  8. 'name' => 'Citation',
  9. ),
  10. );
  11. $citation = chado_generate_var('pubprop', $values);
  12. $citation = chado_expand_var($citation, 'field', 'pubprop.value');
  13. // get the abstract
  14. $values = array(
  15. 'pub_id' => $pub->pub_id,
  16. 'type_id' => array(
  17. 'name' => 'Abstract',
  18. ),
  19. );
  20. $abstract = chado_generate_var('pubprop', $values);
  21. $abstract = chado_expand_var($abstract, 'field', 'pubprop.value');
  22. $abstract_text = '';
  23. if ($abstract) {
  24. $abstract_text = htmlspecialchars($abstract->value);
  25. $abstract_text = substr($abstract_text, 0, 450);
  26. $abstract_text .= "... " . l("[more]", "node/$node->nid");
  27. }
  28. $teaser_text = "<ul id=\"tripal-pub-teaser-citation\"><li>" . $citation->value . "</li></ul>" . $abstract_text;
  29. ?>
  30. <div class="tripal_pub-teaser tripal-teaser">
  31. <div class="tripal-pub-teaser-title tripal-teaser-title"><?php
  32. print l($pub->title, "node/$node->nid", array('html' => TRUE));?>
  33. </div>
  34. <div class="tripal-pub-teaser-text tripal-teaser-text"><?php
  35. print $teaser_text; ?>
  36. </div>
  37. </div>