PHP Random Paragraph

Discussion in 'PHP' started by wd_2k6, May 16, 2008.

  1. #1
    Hi I'm not too sure whether to do this via PHP or JS..

    Lets say I have a Wordpress Admin Screen whereby I define a selection of variable for example:

    $blah = gooo
    $boo = gogogo
    $boom = whatever

    OK then I have a submit post button. However before the post is submitted It will choose one of 4 Random paragraphs for the post to contain based on these variables for example.

    Par 1 = $Blah went to School with $Boo and $Boom
    Par 2 = $Boo wasn't happy with $Blah or $Boom

    The Paragraph it chooses is completly random or it could scroll through the list, however I need it to be done automatically?

    Note: This happens before the post is submitted. For example the user doesn't get different pargraphs on refresh, this paragraph is chosen before the post is submitted and it stays as that.
     
    wd_2k6, May 16, 2008 IP
  2. Altari

    Altari Peon

    Messages:
    188
    Likes Received:
    4
    Best Answers:
    0
    Trophy Points:
    0
    #2
    Where will you save the paragraphs?

    Should the use see the paragraph before they submit?

    If they leave the page, then return later, will they get the same paragraph as before?
     
    Altari, May 16, 2008 IP
  3. wd_2k6

    wd_2k6 Peon

    Messages:
    1,740
    Likes Received:
    54
    Best Answers:
    0
    Trophy Points:
    0
    #3
    Well it's for the person who uses the theme. To automate the site, they want the content auto generated.

    So I thought choosing one of 4 paragraphs based on the variables given.

    This should only take place in the admin write post screen, so the user will always get the same paragpaph, e.g the calculations and paragraph is decided before the submission of an article.
     
    wd_2k6, May 17, 2008 IP