Generate a random number?

For support and discussion related to templates, themes, and imagesets in phpBB 3.0.
Get Involved
Locked
microUgly
Registered User
Posts: 88
Joined: Sat Jun 02, 2007 5:35 am

Generate a random number?

Post by microUgly »

I want to make a simple template modification to display random content. The the phpBB template syntax have something like:

Code: Select all

<!-- IF rand(1,2) == 1 -->
  <p>You're number #1</p>
<!-- ELSE -->
  <p>You're number #2</p>
<!-- ENDIF -->
I understand I could do this, but I'm not clear on where the PHP portion is best placed:

Code: Select all

$template->assign_var('COIN_FLIP', rand(1,2));

<!-- IF COIN_FLIP == 1 -->
  <p>You're number #1</p>
<!-- ELSE -->
  <p>You're number #2</p>
<!-- ENDIF -->
Locked

Return to “[3.0.x] Styles Support & Discussion”