'/gallery/index.html', 'skip-template' => true ); $galleries = perch_content_custom('Galleries', $opts, true); $the_gallery = false; if( isset($_GET['g']) ) { $g = $_GET['g']; foreach( $galleries as $gallery ) { if( $gallery['slug'] == $g ) { $the_gallery = $gallery; break; } } } // If gallery no longer exists or an invalid argument has been passed, redirect to galleries index if( !$the_gallery ) { header('Location: /gallery'); exit; } $image_id = (isset( $_GET['i'] ) && $_GET['i'] < 9 && $_GET['i'] > 0) ? $_GET['i'] : 1; // Clean up gallery incase user has not uploaded required thumb and larger image $images = array(); for( $i = 1; $i <= 8; $i++ ) { if( isset($the_gallery['gallery_image_'.$i]) && isset($the_gallery['gallery_image_'.$i.'_thumbnail']) ) { $t = array( 'image' => $the_gallery['gallery_image_'.$i], 'thumb' => $the_gallery['gallery_image_'.$i.'_thumbnail'], 'desc' => $the_gallery['gallery_image_'.$i.'_desc'], 'id' => $i ); $images[] = $t; } } //echo '
'.print_r($the_gallery, true).'
'; //echo '
'.print_r($images, true).'
'; ?> JAC Interiors - Gallery - <?php echo $the_gallery['name']; ?>