Jump to content

djmike

New Members
  • Posts

    6
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

djmike's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. Thanks so much for the help, I got it sorted, but bits[0] display the whole file path and so didn't work. I had to explode it further to remove the file path: [code] $bits = explode(".",$tmp) ; // $bits[0] will be filepath/TY, etc. $bits2 = explode("path/",$bits[0]) ; // $bits2[1] will be TY, etc. [/code] Thanks again
  2. Thanks, that works fantastically. I just need to now change it so that upon clicking the picture (using <a href) the user is directed to a php page with ?t= followed by the initial that were the picture's name. So for the image TY.jpg, the link would be mysite.com/viewer.php?t=TY However, as I created an array, I only have the complete paths stored not the original files. Is the best way to create another array for the file names, ut I'm not sure how this would work it may randomise twice so the link doesn't match the image Thanks again
  3. Ok, could you give example code please. I understand the rand function, and have already got a function using the time() to get a random number. I just don't understand who I'd use glob() with the images to create an array? Thanks
  4. I am looking for a PHP script that will randomly display an image from a folder of around 20 images, although there will be more soon. The images names are all initials, e.g. TY. I could do a script to pick images if their names were all number going up from 1, but I'm not sure if this is possible with the above? Thanks for any suggestions
  5. Thanks, that's sorted now. When should ' be used, and when should " be used, jsut for future reference
  6. I'm writing a script that will randomly insert news into a sidebox on my website. However, the site allows users to choose their 'skin' and this is passed to other pages via the url. So a link to a page called "hr0.php" is this:     php:<a href="hr0.php?p=<? echo $p; ?>">Introduction</a> I have the code to randomly pick a number, then the HTML code to display that story and any assossciated images is loaded into a variable. This is all done in a separate file from the page where it will be displayed (as it will be used to fill the sideboxes of many pages.) In the sidebox I also want to include a link, so if the user is interested they can click it and be taken straight to the page. However, I am having trouble because it doesn't work having php code, within html code, being loaded into a php variable and then echoed. This is the code within my random picking file that loads the variable that I want to echo on my target page:     php:     $body = "<p align=\"center\"><img src=\"images/l2-019.jpg\" width=\"155\" height=\"156\" /></p>           <p align=\"center\">      <a href=\"hr0.php?p=<? echo $p; ?>\">Introduction</a>" This works and does show the image and word "introduction" but upon clicking it the colour reverts to the default. Any ideas please? Thanks
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.