Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2008-01-24 13:46:43

Sam
Member
From: New York City
Registered: 2004-06-26
Posts: 127
Website

How-to: Display Random Forms ?

Hi,

I know you can use random articles, but is it possible to somehow output a random form?

The scenario is I want to place advertisements in forms (ad_1, ad_2, etc.) and have them displayed on the individual article page between the end of the article and the before the comments.

How could I best accomplish this?

Thanks!

Offline

#2 2008-01-24 15:08:48

ruud
Developer Emeritus
From: a galaxy far far away
Registered: 2006-06-04
Posts: 5,068
Website

Re: How-to: Display Random Forms ?

Perhaps something like this (not tested):

<txp:php>
  $forms = array('form1', 'form2', 'form3');
  echo output_form(array('form' => $forms[rand(0, count($forms)-1)]));
</txp:php>

Offline

#3 2008-01-24 15:50:02

Sam
Member
From: New York City
Registered: 2004-06-26
Posts: 127
Website

Re: How-to: Display Random Forms ?

Interesting.. that worked perfectly!

Thanks ruud!

Offline

Board footer

Powered by FluxBB