kbryant414
Active member
Hello.
For my forum, Post Terminus, I've been trying to set a Notice for visitors that are not logged in, inviting them to register/join. I can get that to work well enough with one image, but since this is for a writing RP forum, I was hoping to have the Notice randomly pick one from a series of character images and quotes I'm preparing (4 at the start, with more to be added later).
I read through this thread (https://xenforo.com/community/resources/display-a-random-banner.375/) and tried to apply it, but it's displaying all four images and quotes where I'm defining the variables, and where it's supposed to pick one randomly, it's instead displaying the Xen code.
Since the thread there is specifically for banners and ads, is it not applicable to images/Notices? Or (perhaps more likely) am I using the code incorrectly? Any help would be appreciated. Thank you.
For my forum, Post Terminus, I've been trying to set a Notice for visitors that are not logged in, inviting them to register/join. I can get that to work well enough with one image, but since this is for a writing RP forum, I was hoping to have the Notice randomly pick one from a series of character images and quotes I'm preparing (4 at the start, with more to be added later).
I read through this thread (https://xenforo.com/community/resources/display-a-random-banner.375/) and tried to apply it, but it's displaying all four images and quotes where I'm defining the variables, and where it's supposed to pick one randomly, it's instead displaying the Xen code.
Since the thread there is specifically for banners and ads, is it not applicable to images/Notices? Or (perhaps more likely) am I using the code incorrectly? Any help would be appreciated. Thank you.
HTML:
<!-- Defining variables for character images and quotes -->
<xen:set var="$regImg.1">
<a href="register/" onclick="_gaq.push(['_trackEvent', 'Button', 'Click', 'Chibi01']);"><img min-height:180px src="imagelib/register/Chibi01.gif" alt="Come Join Post Terminus!" title="Come Join Post Terminus!"></a>
</xen:set>
<xen:set var="$regQuo.1">I'm not lost, just in transit...</xen:set>
<xen:set var="$regImg.2">
<a href="register/" onclick="_gaq.push(['_trackEvent', 'Button', 'Click', 'Chibi02']);"><img min-height:180px src="imagelib/register/Chibi02.gif" alt="Come Join Post Terminus!" title="Come Join Post Terminus!"></a>
</xen:set>
<xen:set var="$regQuo.2">How could I not care? I never knew them!</xen:set>
<xen:set var="$regImg.3">
<a href="register/" onclick="_gaq.push(['_trackEvent', 'Button', 'Click', 'Chibi03']);"><img min-height:180px src="imagelib/register/Chibi03.gif" alt="Come Join Post Terminus!" title="Come Join Post Terminus!"></a>
</xen:set>
<xen:set var="$regQuo.3">Life's cheap... Death pays.</xen:set>
<xen:set var="$regImg.4">
<a href="register/" onclick="_gaq.push(['_trackEvent', 'Button', 'Click', 'Chibi04']);"><img min-height:180px src="imagelib/register/Chibi04.gif" alt="Come Join Post Terminus!" title="Come Join Post Terminus!"></a>
</xen:set>
<xen:set var="$regQuo.4">Apologies... It's just business.</xen:set>
<!-- Selecting image and quote randomly to display in Notice. -->
<table>
<tr>
<td>
<xen:foreach loop="$regImg" value="$curRegImg" i="$i" count="$count">
<xen:if is="!{$rand}">
<xen:set var="$rand">{xen:calc '({$serverTime} % {$count}) + 1'}</xen:set>
</xen:if>
<xen:if is="{$i} == {$rand}">
{xen:raw '$regImg.{$rand}'}
</xen:if>
</xen:foreach>
</td>
<td>
<p class="loginMessage">
<div class="triangle-border left">
<xen:foreach loop="$regQuo" value="$curRegQuo" i="$i" count="$count">
<xen:if is="!{$rand}">
<xen:set var="$rand">{xen:calc '({$serverTime} % {$count}) + 1'}</xen:set>
</xen:if>
<xen:if is="{$i} == {$rand}">
{xen:raw '$regQuo.{$rand}'}
</xen:if>
</xen:foreach>
</div>
</td>
</tr>
<tr>
<td>
<p style="font-size:24px" align="center" class="loginMessage">
<b><a href="register/" onclick="_gaq.push(['_trackEvent','Button','Click','Link']);" class="loginLink">Click here!</a></b>
</td>
<td>
<p style="font-size:14px" align="center" class="loginMessage">Join us in Post Terminus
</td>
</tr>
</table>