include __DIR__.'/config.php';
function getGalleryImages($segment,$rename_arr_,$image_groups_,$only_first=false){
$arr = [];
if (!isset($image_groups_[$segment])) {
return $arr;
}
foreach ($image_groups_[$segment] as $image){
if (is_string($image)){
$path = 'domain/triumfpalas.ru/gallery/'.$rename_arr_[$image];
$arr[] = $path;
if ($only_first){
return $path;
}
} else {
foreach ($image as $image_sub){
$path = 'domain/triumfpalas.ru/gallery/'.$rename_arr_[$image_sub];
$arr[] = $path;
if ($only_first){
return $path;
}
}
}
}
return $arr;
}
$segment = strtolower(end(explode('/',parse_url(JURI::current(),PHP_URL_PATH))));
$jl = new JConfig();
JLayoutHelper::$defaultBasePath = pathinfo(JModuleHelper::getLayoutPath('mod_xml_gallery'))['dirname'];
if ($segment=='galereya'){
foreach ($image_groups_ as $group_index => $group){
$item['name'] = $image_names_[$group_index];
$item['image'] = getGalleryImages($group_index,$rename_arr_,$image_groups_,true);
$item['link'] = '/galereya/'.$group_index;
$cats[] = $item;
}
echo JLayoutHelper::render('category', array('cats'=> $cats));
} else {
$images = getGalleryImages($segment,$rename_arr_,$image_groups_);
$images = array_unique($images);
echo JLayoutHelper::render('gallery', array('images'=> $images,'category_name'=>$image_names_[$segment]));
}
?>