I am creating an image gallery which puts all images into an array, and then sorts them accordign to variables specified in the querystring. For example, only images belonging to a certain gallery name will show if the gallery name is defined in the querystring.
I want search for a keyword in the existing array, then have the results returned in a new array, which I will use to display the images in order.
I am having problems trying to search and sort the array by keyword.
Here is a sample of how my array is set up:
$img[1] = Array("imgName","url_of_image","GalleryName","Other_keywords_to_sortBy");
$img[2] = Array("Cat","/images/photos/cat.jpg","BlackCats","cats");
$img[3] = Array("Cat2","/images/photos/cat2.jpg","BlackCats","cats");
$img[4] = Array("Cat3","/images/photos/ca3t.jpg","StripedCats","stripes");
So, if the querystring specifies the sortType as gallery and subCategory as cats (both specified in querystring), I would like to search the galleryname of the entire array to see if it matches the subCategory (in this case, cats) and then display only those results on the page.
Not sure if this is makign sense, but I am relatively new to arrays of this sort in php, and would like any advice/suggestions/help.
I want search for a keyword in the existing array, then have the results returned in a new array, which I will use to display the images in order.
I am having problems trying to search and sort the array by keyword.
Here is a sample of how my array is set up:
$img[1] = Array("imgName","url_of_image","GalleryName","Other_keywords_to_sortBy");
$img[2] = Array("Cat","/images/photos/cat.jpg","BlackCats","cats");
$img[3] = Array("Cat2","/images/photos/cat2.jpg","BlackCats","cats");
$img[4] = Array("Cat3","/images/photos/ca3t.jpg","StripedCats","stripes");
So, if the querystring specifies the sortType as gallery and subCategory as cats (both specified in querystring), I would like to search the galleryname of the entire array to see if it matches the subCategory (in this case, cats) and then display only those results on the page.
Not sure if this is makign sense, but I am relatively new to arrays of this sort in php, and would like any advice/suggestions/help.