| [ Index ] |
PHP Cross Reference of Drupal 6 (gatewave) |
[Summary view] [Print] [Text view]
1 A gallery's cover image is a single image from that gallery, selected according to a particular criterion. For example, the cover for each gallery might be the most recent image in that gallery. 2 3 If a gallery has no descendant galleries, this is a simple procedure. However, what to do when the gallery itself contains galleries is a more complicated matter. 4 5 There are three ways to handle descendant galleries when getting a cover image for a gallery. 6 7 <dl> 8 <dt>Plain</dt> 9 <dd>Do not go into any descendant galleries: only consider images in the gallery itself. If the gallery itself has no images, then there will be no cover node. 10 </dd> 11 12 <dt>Flat</dt> 13 <dd>Consider the gallery itself and its descendants to a given depth as one single pool of images from which to select the cover. 14 </dd> 15 16 <dt>Recursion</dt> 17 <dd>Consider first the gallery itself, and if it is empty, consider each child gallery one at a time (in weight order). The recusion depth sets how far to go into a child gallery's own children before giving up and moving to the next child gallery. Be warned that this is potentially a time-consuming procedure!</dd> 18 19 </dl> 20 21 These methods are illustrated in this example. 22 23 Consider the following tree of galleries: the numbers are the term IDs that make the galleries and the letters are the titles of the image nodes. 24 25 <pre> 26 - 1: empty 27 - 2: empty 28 - 6: nodes G, H 29 - 3: nodes M, N 30 - 4: nodes D, E, F 31 - 5: nodes X, Y, Z 32 - 7: nodes A, B 33 </pre> 34 35 Suppose our sort criterion for the cover is the image node title in alphabetical order. What cover image will gallery 1 have? 36 37 <dl> 38 <dt>Plain</dt> 39 <dd>Term 1 has no nodes: there is no cover image. 40 </dd> 41 42 <dt>Flat depth 0; Recursion depth 0</dt> 43 <dd>Depth 0 means we don't go into child galleries: so this is the same as plain and there is no cover image. 44 </dd> 45 46 <dt>Flat depth 1</dt> 47 <dd>We consider all nodes in the galleries 1, 2, 3, 4, 5. 48 The first node by name is D. 49 </dd> 50 51 <dt>Flat depth 2</dt> 52 <dd>We consider all nodes in the galleries 1, 2, 3, 4, 5, 6, 7. 53 The first node by name is A. 54 </dd> 55 56 <dt>Recursion depth 1</dt> 57 <dd>We find the gallery itself empty, so look in gallery 2. 58 That's empty too, so we look in gallery 3. 59 Here we find nodes, and M is the first by name: so the cover is M.</dd> 60 61 <dt>Recursion depth 2</dt> 62 <dd>We find the gallery itself empty, so look in gallery 2. 63 That's empty too, and so we go one level deeper to gallery 6. 64 Here we find nodes, and G is the first by name: so the cover is G. 65 Node A is a better fit at this depth, but we consider child galleries one by one, by weight, and we found something in gallery 6.</dd> 66 </dl>
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
| Generated: Thu Mar 24 11:18:33 2011 | Cross-referenced by PHPXref 0.7 |