| 1 |
// $Id: README.txt,v 1.4 2007/12/16 17:41:41 sutharsan Exp $
|
| 2 |
|
| 3 |
This module allows you to display an image in a block where the selection
|
| 4 |
of the image is based on conditions per image.
|
| 5 |
|
| 6 |
Each image, included in a node, can be shown based on node id, path,
|
| 7 |
taxonomy, book or PHP code. Headerimage has an arbitrary node type to work
|
| 8 |
with.
|
| 9 |
|
| 10 |
Multiple images (nodes) can be displayed in one block, with each image
|
| 11 |
having its own conditions. Using a weight per node the order of selection
|
| 12 |
can be controlled.
|
| 13 |
|
| 14 |
|
| 15 |
-- INSTALLATION --
|
| 16 |
|
| 17 |
* Copy header image module to your modules directory and enable it on the
|
| 18 |
admin modules page.
|
| 19 |
|
| 20 |
* Set access rights for admin and view on the access control page.
|
| 21 |
|
| 22 |
* If required create a node type to put your image in.
|
| 23 |
Set node type(s) and conditions types on the header image settings page
|
| 24 |
Site configuration > Header image > Settings
|
| 25 |
|
| 26 |
* Create one or more blocks for header image at the add block page.
|
| 27 |
Site configuration > Header image > Add
|
| 28 |
|
| 29 |
* Using the selected node type, upload one image into the node using a CCK
|
| 30 |
image field.
|
| 31 |
Image header is designed to work with a node containing only one image.
|
| 32 |
However with custom theming you can display any node content and any
|
| 33 |
part of the node content. By default the node content without the
|
| 34 |
title, taxonomy or links is shown in teaser view.
|
| 35 |
|
| 36 |
* Enter the display conditions to the node.
|
| 37 |
Different type of conditions are available: node id, URL, taxonomy, etc.
|
| 38 |
Select the conditions types you will use (site wide) on the header image
|
| 39 |
settings page: Site configuration > Header image > Settings
|
| 40 |
|
| 41 |
The header image node will be displayed when one of it's display conditions
|
| 42 |
are met (evaluated to TRUE). Empty or not selected conditions are evaluated
|
| 43 |
false.
|
| 44 |
|
| 45 |
For testing purpose it may be convenient to show a block on all pages.
|
| 46 |
See Troubleshooting below.
|
| 47 |
|
| 48 |
* Change the weight of the display condition to influence the order in which
|
| 49 |
display conditions are evaluated from one node to another. For example,
|
| 50 |
a header image node with weight 0 is evaluated before a header image with
|
| 51 |
weight 1.
|
| 52 |
|
| 53 |
* Assign the block to the region of your choice in the Blocks administration
|
| 54 |
page.
|
| 55 |
Site building > Blocks
|
| 56 |
|
| 57 |
|
| 58 |
-- TROUBLESHOOTING --
|
| 59 |
|
| 60 |
* Use the condition weight to control the order in which the conditions are
|
| 61 |
evaluated. The node with the smallest weight number will be evaluated
|
| 62 |
first.
|
| 63 |
Tip: To use one image as default give it a high weight (10) and a
|
| 64 |
condition always evaluating to true.
|
| 65 |
For example: path: '*' or PHP: <?php return true; ?>
|
| 66 |
|
| 67 |
* If the block is (partly) not visible, check the Display settings of your
|
| 68 |
node type. Header image uses the teaser view or full view depending
|
| 69 |
on the Teaser setting.
|
| 70 |
Administer > Content management > Content types > MyHeaderImageContentType > Display fields
|
| 71 |
|
| 72 |
|
| 73 |
-- THEMING --
|
| 74 |
|
| 75 |
* By default the block will show the content of the node, without the
|
| 76 |
title, taxonomy or links. The node is shown in teaser view or full view
|
| 77 |
depending on the Teaser setting.
|
| 78 |
|
| 79 |
* To show the full node with title, taxonomy, etc. use the theme function
|
| 80 |
included at the bottom of this README file.
|
| 81 |
|
| 82 |
|
| 83 |
-- AUTHOR --
|
| 84 |
|
| 85 |
Erik Stielstra
|
| 86 |
For contact: http://drupal.org/user/73854
|
| 87 |
|
| 88 |
|
| 89 |
-- THEMING SNIPPET --
|
| 90 |
To customize the theming of the Header Image block, copy the snippet below in your
|
| 91 |
theme template.php file and modify the code to your needs.
|
| 92 |
|
| 93 |
/**
|
| 94 |
* Custom implementation of theme_headerimage_block()
|
| 95 |
*
|
| 96 |
* To show the full node with title, taxonomy, etc.
|
| 97 |
*/
|
| 98 |
function phptemplate_headerimage_block($node, $teaser = true) {
|
| 99 |
if (!$node->status) {
|
| 100 |
$output = '<div class="node-unpublished">';
|
| 101 |
}
|
| 102 |
|
| 103 |
if (module_exists('taxonomy')) {
|
| 104 |
$terms = taxonomy_link('taxonomy terms', $node);
|
| 105 |
}
|
| 106 |
|
| 107 |
$output .= t('!title by !name', array('!title' => '<h2 class="title">'. check_plain($node->title) .'</h2>', '!name' => theme('username', $node)));
|
| 108 |
|
| 109 |
if (count($terms)) {
|
| 110 |
$output .= ' <small>('. theme('links', $terms) .')</small><br />';
|
| 111 |
}
|
| 112 |
|
| 113 |
if ($teaser && $node->teaser) {
|
| 114 |
$output .= $node->teaser;
|
| 115 |
}
|
| 116 |
else {
|
| 117 |
$output .= $node->body;
|
| 118 |
}
|
| 119 |
|
| 120 |
if ($node->links) {
|
| 121 |
$output .= '<div class="links">'. theme('links', $node->links) .'</div>';
|
| 122 |
}
|
| 123 |
|
| 124 |
if (!$node->status) {
|
| 125 |
$output .= '</div>';
|
| 126 |
}
|
| 127 |
|
| 128 |
return $output;
|
| 129 |
}
|