Здраствуйте!
Хотелось бы поинтересоваться, можно ли как-то вывести блоки с названием альбома, количеством просмотров, датой публикации и все те, что можно найти в файле functions.inc.php в функции build_caption по отдельности в файле theme.php? Мне не очень хочется редактировать файл с функциями, и я пытаюсь найти возможность вывести каждый блок по отдельности в файле определенной темы. Немного покопавшись в коде, мне удалось вывести по отдельности название альбома, имя файла, размер файла, а также его высоту и ширину. Получилось что-то вроде этого:
if ($mode == 'thumb') {
if (in_array($aid, $album_types['albums'])) {
$params = array(
'{CELL_WIDTH}' => $cell_width,
'{LINK_TGT}' => "thumbnails.php?album={$thumb['aid']}",
'{THUMB}' => $thumb['image'],
'{CAPTION}' => $thumb['caption'],
'{ADMIN_MENU}' => $thumb['admin_menu'],
'{ALBUMS_TITLE}' => $thumb['title'],
'{FILE_NAME}' => $thumb['filename'],
'{IMAGE_WIDTH}' => $thumb['pwidth'],
'{IMAGE_HEIGHT}' => $thumb['pheight'],
'{IMAGE_SIZE}' => floor($thumb['filesize']/1024),
);
} else {
// determine if thumbnail link targets should open in a pop-up
if ($CONFIG['thumbnail_to_fullsize'] == 1) { // code for full-size pop-up
if (!USER_ID && $CONFIG['allow_unlogged_access'] <= 2) {
$target = 'javascript:;" onclick="alert(\''.sprintf($lang_errors['login_needed'],'','','','').'\');';
} elseif (USER_ID && USER_ACCESS_LEVEL <= 2) {
$target = 'javascript:;" onclick="alert(\''.sprintf($lang_errors['access_intermediate_only'],'','','','').'\');';
} else {
$target = 'javascript:;" onclick="MM_openBrWindow(\'displayimage.php?pid=' . $thumb['pid'] . '&fullsize=1\',\'' . uniqid(rand()) . '\',\'scrollbars=yes,toolbar=no,status=no,resizable=yes,width=' . ((int)$thumb['pwidth']+(int)$CONFIG['fullsize_padding_x']) . ',height=' . ((int)$thumb['pheight']+(int)$CONFIG['fullsize_padding_y']). '\');';
}
} elseif ($aid == 'random') {
$target = "displayimage.php?pid={$thumb['pid']}$uid_link#top_display_media";
} elseif ($aid == 'lastcom' || $aid == 'lastcomby') {
$page = cpg_get_comment_page_number($thumb['msg_id']);
$page = (is_numeric($page)) ? "&page=$page" : '';
$target = "displayimage.php?album=$aid$cat_link$date_link&pid={$thumb['pid']}$uid_link&msg_id={$thumb['msg_id']}$page#comment{$thumb['msg_id']}";
} else {
$target = "displayimage.php?album=$aid$cat_link$date_link&pid={$thumb['pid']}$uid_link#top_display_media";
}
$params = array(
'{CELL_WIDTH}' => $cell_width,
'{LINK_TGT}' => $target,
'{THUMB}' => $thumb['image'],
'{CAPTION}' => $thumb['caption'],
'{ADMIN_MENU}' => $thumb['admin_menu'],
);
}
Вся проблема заключается в невозможности вывести количество просмотров, дату публикации, количество комментариев, имя владельца файла и его описании.
function build_caption(&$rowset, $must_have = array(), $mode = 'files')
{
global $CONFIG, $THEME_DIR, $lang_date, $lang_get_pic_data, $cpg_udb;
foreach ($rowset as $key => $row) {
$caption = '';
if ($CONFIG['views_in_thumbview'] || in_array('hits', $must_have)) {
$views = ($mode == 'albums') ? $row['alb_hits'] : $row['hits'];
$caption .= '<span class="thumb_title thumb_title_views">' . sprintf($lang_get_pic_data['n_views'], $views) . '</span>';
}
if ($CONFIG['caption_in_thumbview'] && !empty($row['caption'])) {
$caption .= '<span class="thumb_caption thumb_caption_caption">' . strip_tags(bb_decode($row['caption'])) . '</span>';
}
if ($CONFIG['display_comment_count'] && $row['pid']) {
$comments_nr = count_pic_comments($row['pid']);
if ($comments_nr > 0) {
$caption .= '<span class="thumb_num_comments">' . sprintf($lang_get_pic_data['n_comments'], $comments_nr) . '</span>';
}
}
if ($CONFIG['display_uploader']) {
if ($row['owner_id']) {
$caption .= '<span class="thumb_title thumb_title_owner"><a href="profile.php?uid=' . $row['owner_id'] . '">' . $cpg_udb->get_user_name($row['owner_id']) . '</a></span>';
}
}
if (in_array('msg_date', $must_have)) {
$caption .= '<span class="thumb_caption thumb_caption_msg_date">' . localised_date($row['msg_date'], $lang_date['lastcom']) . '</span>';
}
if (in_array('msg_body', $must_have)) {
$msg_body = strip_tags(bb_decode($row['msg_body'])); // I didn't want to fully bb_decode the message where report to admin isn't available. -donnoman
$msg_body = utf_strlen($msg_body) > 50 ? utf_substr($msg_body, 0, 50) . '...' : $msg_body;
if ($CONFIG['enable_smilies']) {
$msg_body = process_smilies($msg_body);
}
if ($row['author_id']) {
$caption .= '<span class="thumb_caption thumb_caption_author"><a href="profile.php?uid=' . $row['author_id'] . '">' . $row['msg_author'] . '</a>: ' . $msg_body . '</span>';
} else {
$caption .= '<span class="thumb_caption thumb_caption_author">' . $row['msg_author'] . ': ' . $msg_body . '</span>';
}
}
if (in_array('ctime', $must_have)) {
$caption .= '<span class="thumb_caption thumb_caption_ctime">' . localised_date($row['ctime'], $lang_date['lastup']) . '</span>';
}
if (in_array('pic_rating', $must_have)) {
if (defined('THEME_HAS_RATING_GRAPHICS')) {
$prefix = $THEME_DIR;
} else {
$prefix = '';
}
//calculate required amount of stars in picinfo
$rating = round(($row['pic_rating'] / 2000) / (5 / $CONFIG['rating_stars_amount']));
$rating_images = '';
for ($i = 1; $i <= $CONFIG['rating_stars_amount']; $i++) {
if ($i <= $rating) {
$rating_images .= '<img src="' . $prefix . 'images/rate_full.png" alt="' . $rating . '"/>';
} else {
$rating_images .= '<img src="' . $prefix . 'images/rate_empty.png" alt="' . $rating . '"/>';
}
}
$caption .= '<span class="thumb_caption thumb_caption_rating">' . $rating_images . '<br />' . sprintf($lang_get_pic_data['n_votes'], $row['votes']) . '</span>';
}
if (in_array('mtime', $must_have)) {
$caption .= '<span class="thumb_caption thumb_caption_mtime">' . localised_date($row['mtime'], $lang_date['lasthit']);
if (GALLERY_ADMIN_MODE) {
$caption .= '<br />' . $row['lasthit_ip'];
}
$caption .= '</span>';
}
$rowset[$key]['caption_text'] = $caption;
}
$rowset = CPGPluginAPI::filter('thumb_caption', $rowset);
}
Подскажите, пожалуйста, есть ли какой-то способ вывести их? Если нет, то ничего страшного. Просто любопытно.