WordPress.org

Forums

php problem... (8 posts)

  1. thejb
    Member
    Posted 9 years ago #

    okay. So i loaded a new theme. which I think is great.

    'cept my problem is I don't know php.

    the photos rotate, randomly like the code says. but once I add more then when I load the page a blank white space sits in the place of the photo. /

    I have named all my files properly. yet can't work it out.. check it out below.

    <?php
    function header_graphic() {
    echo "/images/";

    $num=rand(0,1); <!--this is the original I changed it to (0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20); /-->
    echo "dream".$num.".jpg";
    };
    ?>
    <!-- The header image is aleatory change. You can show how many images you want (526 x 265 pixels), but you can must name them like this: dream0.jpg ; dream1.jpg, dream3.jpg…. and so on… and make the appropriate modification in the header_graphic function above.
    -->

    pls hlp
    Joe

  2. Samuel B
    moderator
    Posted 9 years ago #

    Do you need the / after 20); ?
    Also, have you tried using an absolute uri?

  3. thejb
    Member
    Posted 9 years ago #

    okay.. there is no / I just used that for commenting on this page. what exactly is an absolute uri? and how do I go about implementing it.

    I learn quick.

  4. thejb
    Member
    Posted 9 years ago #

    okay.. uri basically you mean a url?

  5. Samuel B
    moderator
    Posted 9 years ago #

    Yes url.

  6. thejb
    Member
    Posted 9 years ago #

    okay.

    where abouts would I use it.

    like I understand the script.

    could you give an example.

    thanks for bothering btw

  7. thejb
    Member
    Posted 9 years ago #

    okay I worked out what you meant and tried it.

    no change though.

  8. thejb
    Member
    Posted 9 years ago #

    okay for anyone else with this problem... here is the answer.

    (0,1)

    will produce a random number from 0-1

    (0,9)

    will produce a random number from 0-9

    in my case I will be using (0,24)
    see the result at

    anotherpk

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.