tag:help-archives.hannonhill.com,2010-02-09:/discussions/velocity-formats/26-ifelseCascade CMS: Discussion 2018-10-18T20:36:15Ztag:help-archives.hannonhill.com,2010-02-09:Comment/71462872011-05-10T19:40:26Z2011-05-10T19:40:26ZIf/else<div><p>Found a working solution:<br>
<code>#if ($image != "/")</code></p>
<pre>
<code> `<div class="faculty-image"><img src="${image}" alt="$alt" /></div>`
`#else`</code>
</pre>
<p><code><div class="faculty-image"></div></code></p>
<p><code>#end</code></p></div>steelejtag:help-archives.hannonhill.com,2010-02-09:Comment/71462872011-05-10T19:53:58Z2011-05-10T19:53:58ZIf/else<div><p>This is one of the idiosyncrasies of the "chooser" elements in
data definitions: When nothing is chosen, the "path" child element
of the chooser element will always have a value of "/".</p></div>Brent Arringtontag:help-archives.hannonhill.com,2010-02-09:Comment/71462872011-05-10T19:55:35Z2011-05-10T19:55:35ZIf/else<div><p>Similar problem with the individual faculty pages that are
indexed:</p>
<p><code>#set ($image = $_XPathTool.selectSingleNode($contentRoot,
"/system-index-block/calling-page/system-page/system-data-structure/Staff/image/path"))</code>
<code>#set ($alt= "$name,&#32;$title1.value")</code></p>
<p>This displays the image and alt fine:</p>
<p><code><img src="$_SerializerTool.serialize($image, true)"
alt="$alt" /></code></p>
<p>Following doesn't work:</p>
<p><code>#if ($image != "\")</code></p>
<pre>
<code>`<div class="faculty-image"><img src="$_SerializerTool.serialize($image, true)" alt="$alt" /></div>`
`#else`
`<div class="faculty-image"></div> #end`</code>
</pre></div>steelejtag:help-archives.hannonhill.com,2010-02-09:Comment/71462872011-05-10T19:57:52Z2011-05-10T19:57:52ZIf/else<div><p>In this example, you didn't add <code>.value</code> to the end
of your <code>.selectSingleNode(...)</code> call, so
<code>$image</code> is not text, but rather an Element object.</p></div>Brent Arringtontag:help-archives.hannonhill.com,2010-02-09:Comment/71462872011-05-10T20:30:49Z2011-05-10T20:30:49ZIf/else<div><p>Got it. Thanks for your speedy help, as always.</p></div>steelejtag:help-archives.hannonhill.com,2010-02-09:Comment/71462872011-05-10T20:38:46Z2011-05-10T20:38:46ZIf/else<div><p>I spoke too soon. I added the .value but can't get the image to
display. Either with the serializer or by calling
<code>${image}</code></p></div>steelejtag:help-archives.hannonhill.com,2010-02-09:Comment/71462872011-05-10T20:40:42Z2011-05-10T20:40:42ZIf/else<div><p>I'm guessing this syntax is wrong:</p>
<p><code>#set ($image = $_XPathTool.selectSingleNode($contentRoot,
"/system-index-block/calling-page/system-page/system-data-structure/Staff/image/path.value"))</code></p></div>steelejtag:help-archives.hannonhill.com,2010-02-09:Comment/71462872011-05-10T20:47:45Z2011-05-10T20:47:45ZIf/else<div><p>Yes, I found it... <code>path").value)</code></p>
<p>Thanks again.</p></div>steelej