gallery_max = 5; $this->site_dir = 'benrogers'; $this->site_folders = Array ("1"=>"vinyl","2"=>"sound_motion"); } function valid_art($type,$art) { if (is_dir($type.'/'.$art)) return true; else header('Location: http://dreamchimney.com/benrogers/'); } function site_header() { echo 'Ben Rogers Art'; } function site_nav_top($type,$art='') { if ($type == 'vinyl' && $art == '') echo 'Vinyl Painting Gallery | Sound and Motion Gallery'; else if ($type == 'sound_motion' && $art == '') echo 'Vinyl Painting Gallery | Sound and Motion Gallery'; else echo 'Vinyl Painting Gallery | Sound and Motion Gallery'; //echo 'Vinyl Paintings | Audio-Video'; } function site_bottom_nav($art_type) { if ($art_type == 'contact') echo 'CONTACT'; else echo 'CONTACT'; echo ' | '; if ($art_type == 'bio') echo 'BIO'; else echo 'BIO'; echo ' | '; if ($art_type == 'links') echo 'LINKS'; else echo 'LINKS'; } function show_statement($art_type) { if (in_array($art_type,$this->site_folders)) echo file_get_contents('statement_'.$art_type.'.txt'); } // PREVIOUS NEXT NAVIGATION function next_previous($type,$art) { $art_folders = Array(); $art_folders = $this->get_art_list($type); $key = array_search($art,$art_folders); $key_next = $key + 1; if (!array_key_exists($key_next,$art_folders)) $key_next = 0; $key_prev = $key - 1; if (!array_key_exists($key_prev,$art_folders)) $key_prev = sizeof($art_folders) - 1; echo '< Previous Next >'; } // ART PAGE function get_artfiles($type,$art,$filetype) { $files = $this->get_dir_list($type.'/'.$art); foreach ($files as $file) { if (eregi($filetype,$file)) $artwork[] = $art.'/'.$file; } return $artwork; } function show_artwork($type,$art) { if ($type == 'vinyl') { $artwork = $this->get_artfiles($type,$art,'artwork'); // TO-DO get image dimensions $first_margin = ''; if (sizeof($artwork)>1) $first_margin = 'style="margin: 0 0 0 20px"'; foreach ($artwork as $art) $rtn .= ''; echo $rtn; } else if ($type == 'sound_motion') { $artwork = $this->get_artfiles($type,$art,'video'); foreach ($artwork as $art) $rtn .= file_get_contents($type.'/'.$art); echo $rtn; } } function show_detail($type,$art) { $detail = $this->get_artfiles($type,$art,'detail_sm'); // TO-DO get image dimensions if (sizeof($detail)<1) return ''; $count = 1; foreach ($detail as $art) { $detail_lg = str_replace("_sm_","_lg_",$art); $rtn .= '
'; $rtn .= ''; $rtn .= ''; $rtn .= ''; $rtn .= '
'."\n"; $rtn .= 'Detail '.$count.''; $rtn .= '
'."\n"; $count++; } echo $rtn; } function show_content($type,$art) { $content_file = $type.'/'.$art.'/content.txt'; if (is_file($content_file)) { $content = file_get_contents($content_file); $content = str_replace("\n",'
',$content); $content = str_replace('a href="','a href="/benrogers/art.php?art_type=vinyl&art=',$content); echo $content; echo '

'; //$this->show_statement($type); } } function show_navpage($type) { if (is_file($type.".txt")) { $content = file_get_contents($type.".txt"); $content = str_replace("\n",'
',$content); echo $content; } } // GALLERY function make_gallery($type) { if ($type == 'contact') { $this->show_navpage($type); } else if ($type == 'bio') { $this->show_navpage($type); } else if ($type == 'links') { $this->show_navpage($type); } else { $art_folders = $this->get_art_list($type); $printed = 0; foreach ($art_folders as $folder) { // TO-DO if thumbnail jpg is not there should do something ? $printed++; //echo ''; echo ''; if ($printed<5) echo ''; else echo ''; echo ''; if ($printed == $this->gallery_max) { $printed = 0; echo ''; } } if ($printed > 0) echo ''; } } /// END GALLERY // Reads from order text file function get_dir_list($path) { //echo "PATH: ".$path; $handle = opendir($path); while (($file = readdir($handle))!==false) { if ((((!eregi("Icon", $file) && ($file != ".")) && ($file != ".."))) && ($file != ".DS_Store") && (!eregi("php",$file))) { $files[] = $file; } } closedir($handle); return $files; } function get_art_list($folder) { $order_file = $folder.'/order.txt'; if (!is_file($order_file)) {echo 'Missing order file';exit;} $art_folders = Array(); $art_folders = file($order_file); foreach($art_folders as $index => $folder) $art_folders[$index] = rtrim($folder); return $art_folders; } } ?>