[resolved] WP Gurus... I need help! (4 posts)

  1. caryam
    Posted 10 years ago #


    I've got a function creating a random number: in this case placed in a variable called $number.

    I want to do an include of a .txt file in my template, but have it called with the randum number appended to the end of the file name.

    ie, if the random number = 1 then I want to include my_file1.txt, but if the random number = 2 I want to include my_file2.txt

    I know how to do an include with a static file name, but am having trouble with the nuances of appending the random number.

    Any help would be greatly appreciated!

  2. Something like this, maybe?

    $number = rand(1,2);
    $file = "my_file".$number.".txt";
    include $file;

  3. caryam
    Posted 10 years ago #

    Thanks Otto42, I'll give that a try :)

  4. caryam
    Posted 10 years ago #

    That did it!

    Thanks again :)

Topic Closed

This topic has been closed to new replies.

About this Topic