config = &$config; } /** * Make a gallery on a page * * @param array $images * @return String */ function gallery($images){ $this->images = $images; $this->selected = $_GET['selected_image']; $this->lang = $this->config->get_lang(); if($this->lang == ""){ $this->lang = "no"; } if($this->selected == ""){ $this->selected = 0; } return $this->display_image(); } /** * Display an image * * @return String */ function display_image(){ $html = ""; if($this->lang == 'en'){ $next_txt = 'Next'; $prev_txt = 'Previous'; } else{ $next_txt = 'Neste'; $prev_txt = 'Forrige'; } //Show arrows $previous = $this->selected - 1; $next = $this->selected + 1; $html .= "
"; //Previous if($previous >= 0){ $html .= "$prev_txt"; } else{ $html .= "$prev_txt"; } $html .= " - "; //Next if(is_array($this->images[$next])){ $html .= " $next_txt"; } else{ $html .= " $next_txt"; } $html .= "
"; //Show image $image = $this->images[$this->selected]; if(is_array($image)){ $url = $image['url']; $alt = $image['alt']; $html .= "