So, whether or not this was the best way, I had this in a widget: ("output" returned a Page which has a 'Preview Text' variable in it. )
<span class="crossSellImg">
<% control output %>
<a href="$Link">
$Thumbnail</a>
</span>
<span class="crossSellText">
<a href="$Link"><h1>$Title</h1></a>
<% end_control %>
<% if CrossSellContent %>
<p>$CrossSellContent</p>
<% else %>
<% control output %>
<p>$PreviewText</p>
<% end_if %>
<p><a href="$Link">Read more</a></p>
<% end_control %>
</span>
Which meant that if this "CrossSellContent" was anything but null, it'd display that, which belongs to the Widget instance itself rather than the page it links to.
Just replacing the "controls" with "loops" or "withs" doesn't work as it gives SSTemplateParseException - unknown open block "loop".
So it sounds like you can only have one <% loop blah %> per ss?
My rubbish solution is
<span class="crossSellImg">
<% if CrossSellContent %>
<% loop output %>
<a href="$Link">$Thumbnail</a>
</span>
<span class="crossSellText">
<a href="$Link"><h1>$Title</h1></a>
<% end_loop %>
<p>$CrossSellContent</p>
<% else %>
<% loop output %>
<a href="$Link">$Thumbnail</a>
</span>
<span class="crossSellText">
<a href="$Link"><h1>$Title</h1></a>
<p>$PreviewText</p>
<% end_loop %>
<% end_if %>
<p><a href="$Link">Read more</a></p>
</span>
Which just feels totally stupid and repetitive. The best solution would be to somehow break out of the loop, check to see whether this variable exists, print out the relevant variable (of the widget or of the target page) and move on to the closing code.
Can anyone guide the amateur here?