You are here

README.txt in Header image 5

Same filename and directory in other branches
  1. 6 README.txt
  2. 7 README.txt
This module allows you to display an image in a block where the selection
of the image is based on conditions per image.

Each image, included in a node, can be shown based on node id, path,
taxonomy, book or PHP code. Headerimage has an arbitrary node type to work
with.

Multiple images (nodes) can be displayed in one block, with each image
having its own conditions. Using a weight per node the order of selection
can be controlled.


-- INSTALLATION --

* Copy header image module to your modules directory and enable it on the
  admin modules page.

* Set access rights for admin and view on the access control page.

* If required create a node type to put your image in.
  Set node type(s) and conditions types on the header image settings page
  Site configuration > Header image > Settings
  
* Create one or more blocks for header image at the add block page.
  Site configuration > Header image > Add

* Using the selected node type, upload one image into the node using a CCK
  image field.
  Image header is designed to work with a node containing only one image.
  However with custom theming you can display any node content and any
  part of the node content. By default the node content without the
  title, taxonomy or links is shown in teaser view.

* Enter the display conditions to the node.
  Different type of conditions are available: node id, URL, taxonomy, etc. 
  Select the conditions types you will use (site wide) on the header image 
  settings page: Site configuration > Header image > Settings

  The header image node will be displayed when one of it's display conditions 
  are met (evaluated to TRUE). Empty or not selected conditions are evaluated 
  false.

  For testing purpose it may be convenient to show a block on all pages. 
  See Troubleshooting below.

* Change the weight of the display condition to influence the order in which 
  display conditions are evaluated from one node to another. For example, 
  a header image node with weight 0 is evaluated before a header image with 
  weight 1.

* Assign the block to the region of your choice in the Blocks administration
  page.
  Site building > Blocks


-- TROUBLESHOOTING --

* Use the condition weight to control the order in which the conditions are
  evaluated. The node with the smallest weight number will be evaluated
  first.
  Tip: To use one image as default give it a high weight (10) and a
  condition always evaluating to true.
  For example: path: '*' or PHP: <?php return true; ?>

* If the block is (partly) not visible, check the Display settings of your
  node type. Header image uses the teaser view or full view depending
  on the Teaser setting.
  Administer > Content management > Content types > MyHeaderImageContentType > Display fields


-- THEMING --

* By default the block will show the content of the node, without the
  title, taxonomy or links. The node is shown in teaser view or full view
  depending on the Teaser setting.

* To show the full node with title, taxonomy, etc. use the theme function
  included at the bottom of this README file.


-- AUTHOR --

Erik Stielstra
For contact: http://drupal.org/user/73854


-- THEMING SNIPPET --
To customize the theming of the Header Image block, copy the snippet below in your 
theme template.php file and modify the code to your needs.

/**
 * Custom implementation of theme_headerimage_block()
 *
 * To show the full node with title, taxonomy, etc. 
 */
function phptemplate_headerimage_block($node, $teaser = true) {
  if (!$node->status) {
    $output  = '<div class="node-unpublished">';
  }

  if (module_exists('taxonomy')) {
    $terms = taxonomy_link('taxonomy terms', $node);
  }

  $output .= t('!title by !name', array('!title' => '<h2 class="title">'. check_plain($node->title) .'</h2>', '!name' => theme('username', $node)));

  if (count($terms)) {
    $output .= ' <small>('. theme('links', $terms) .')</small><br />';
  }

  if ($teaser && $node->teaser) {
    $output .= $node->teaser;
  }
  else {
    $output .= $node->body;
  }  

  if ($node->links) {
    $output .= '<div class="links">'. theme('links', $node->links) .'</div>';
  }

  if (!$node->status) {
    $output .= '</div>';
  }

  return $output;
}

File

README.txt
View source
  1. This module allows you to display an image in a block where the selection
  2. of the image is based on conditions per image.
  3. Each image, included in a node, can be shown based on node id, path,
  4. taxonomy, book or PHP code. Headerimage has an arbitrary node type to work
  5. with.
  6. Multiple images (nodes) can be displayed in one block, with each image
  7. having its own conditions. Using a weight per node the order of selection
  8. can be controlled.
  9. -- INSTALLATION --
  10. * Copy header image module to your modules directory and enable it on the
  11. admin modules page.
  12. * Set access rights for admin and view on the access control page.
  13. * If required create a node type to put your image in.
  14. Set node type(s) and conditions types on the header image settings page
  15. Site configuration > Header image > Settings
  16. * Create one or more blocks for header image at the add block page.
  17. Site configuration > Header image > Add
  18. * Using the selected node type, upload one image into the node using a CCK
  19. image field.
  20. Image header is designed to work with a node containing only one image.
  21. However with custom theming you can display any node content and any
  22. part of the node content. By default the node content without the
  23. title, taxonomy or links is shown in teaser view.
  24. * Enter the display conditions to the node.
  25. Different type of conditions are available: node id, URL, taxonomy, etc.
  26. Select the conditions types you will use (site wide) on the header image
  27. settings page: Site configuration > Header image > Settings
  28. The header image node will be displayed when one of it's display conditions
  29. are met (evaluated to TRUE). Empty or not selected conditions are evaluated
  30. false.
  31. For testing purpose it may be convenient to show a block on all pages.
  32. See Troubleshooting below.
  33. * Change the weight of the display condition to influence the order in which
  34. display conditions are evaluated from one node to another. For example,
  35. a header image node with weight 0 is evaluated before a header image with
  36. weight 1.
  37. * Assign the block to the region of your choice in the Blocks administration
  38. page.
  39. Site building > Blocks
  40. -- TROUBLESHOOTING --
  41. * Use the condition weight to control the order in which the conditions are
  42. evaluated. The node with the smallest weight number will be evaluated
  43. first.
  44. Tip: To use one image as default give it a high weight (10) and a
  45. condition always evaluating to true.
  46. For example: path: '*' or PHP:
  47. * If the block is (partly) not visible, check the Display settings of your
  48. node type. Header image uses the teaser view or full view depending
  49. on the Teaser setting.
  50. Administer > Content management > Content types > MyHeaderImageContentType > Display fields
  51. -- THEMING --
  52. * By default the block will show the content of the node, without the
  53. title, taxonomy or links. The node is shown in teaser view or full view
  54. depending on the Teaser setting.
  55. * To show the full node with title, taxonomy, etc. use the theme function
  56. included at the bottom of this README file.
  57. -- AUTHOR --
  58. Erik Stielstra
  59. For contact: http://drupal.org/user/73854
  60. -- THEMING SNIPPET --
  61. To customize the theming of the Header Image block, copy the snippet below in your
  62. theme template.php file and modify the code to your needs.
  63. /**
  64. * Custom implementation of theme_headerimage_block()
  65. *
  66. * To show the full node with title, taxonomy, etc.
  67. */
  68. function phptemplate_headerimage_block($node, $teaser = true) {
  69. if (!$node->status) {
  70. $output = '
    ';
  71. }
  72. if (module_exists('taxonomy')) {
  73. $terms = taxonomy_link('taxonomy terms', $node);
  74. }
  75. $output .= t('!title by !name', array('!title' => '

    '. check_plain($node->title) .'

    ', '!name' => theme('username', $node)));
  76. if (count($terms)) {
  77. $output .= ' ('. theme('links', $terms) .')
    ';
  78. }
  79. if ($teaser && $node->teaser) {
  80. $output .= $node->teaser;
  81. }
  82. else {
  83. $output .= $node->body;
  84. }
  85. if ($node->links) {
  86. $output .= '';
  87. }
  88. if (!$node->status) {
  89. $output .= '
';
  • }
  • return $output;
  • }