Jump to content

larstheimpalor

New Members
  • Posts

    3
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

larstheimpalor's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. take into consideration that my array starts with zero and not one [code] //should be fairly obvious $images_per_page = $this->image_num; //count the image array, divide by the # of images per page and round up $total_pages = ceil( count($this->gallery) / $images_per_page ); // if the image's id # is less than the # of images per page set to first page if ($this->x <= $images_per_page) {     $page = 1; // else if the image's id # is greater than the number of images per page take the # of times it takes the # of images per page added to itself to be greater than the image id # and set the page to that } else if ($this->x > $images_per_page) {     for($page = 1; $this->x > $images_per_page; $page++) {         $images_per_page = $images_per_page + $images_per_page;     } } [/code] i think it's sloppy and probably over coded. all of my code is scripted to work with the array starting with 0. i tried to change that and got all confused and it borked on me. so i left it the way it was. if anyone has any constructive suggestions/criticism feel free to chime in. i'm just getting used to programming with php classes. it is pretty cool.
  2. thanks, ShiVer, for the workarounds but i know there is a simple way to do this in an equation or if/then statement. and the reason i wouldn't want to use either of those is that these scripts will be included into other pages and need to be self contained. (i despise popups) also if the user decides to click to the next/previous image in the single image viewer then they would have to hit BACK however many times they clicked, so they might as well use their browser's own back button.
  3. ok i wrote myself a decent photo gallery script that is coming along just fine. i have it setup so that it looks at a folder and grabs all the images files placing them in an array. the columns and rows of images are set by variables. so say i have 12 images total and set the number of columns and rows to 2. now i have a 3 pages with 4 images each. now in my script once you click on any image it goes to a single image viewer. when you click the image again it goes back to the gallery. my problem is that i would like it to go back to the particular page that image is displayed on. the numbers of images, rows, and columns can all vary so i need a calculation or function that will determine which page that image is from based souly on it's number in the array.
×
×
  • 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.