Опубликовано 13 апреля, 20187 г Иногда приходилось делать подобное, чтобы оптимизировать загрузку и кастомизировать вывод кадров на фильмах, которые загружены в дополнительное поле. Итак. для создания тегов аналогичных {image- {fullimage-, но только для доп поля, делаем следующее. 1. В файле show.full.php перед: $category_id = $row['category']; $tpl->compile( 'content' ); добавить if (stripos ( $tpl->copy_template, "{xfimage-" ) !== false || stripos ( $tpl->copy_template, "{xfimageLarge-" ) !== false ) { $xfieldsdata = xfieldsdataload( $row['xfields'] ); $images = array(); preg_match_all('/(img|src)=("|\')[^"\'>]+/i', $xfieldsdata['screens'], $media); $data=preg_replace('/(img|src)("|\'|="|=\')(.*)/i',"$3",$media[0]); foreach($data as $url) { $info = pathinfo($url); if (isset($info['extension'])) { if ($info['filename'] == "spoiler-plus" OR $info['filename'] == "spoiler-minus" ) continue; $info['extension'] = strtolower($info['extension']); if (($info['extension'] == 'jpg') || ($info['extension'] == 'jpeg') || ($info['extension'] == 'gif') || ($info['extension'] == 'png')) array_push($images, $url); } } if ( count($images) ) { $i=0; foreach($images as $url) { $i++; $tpl->copy_template = str_replace( '{xfimage-'.$i.'}', $url, $tpl->copy_template ); $tpl->copy_template = str_replace( '[xfimage-'.$i.']', "", $tpl->copy_template ); $tpl->copy_template = str_replace( '[/xfimage-'.$i.']', "", $tpl->copy_template ); $tpl->copy_template = str_replace( '{xfimagelarge-'.$i.'}', str_replace('thumbs/','',$url), $tpl->copy_template ); $tpl->copy_template = str_replace( '[xfimagelarge-'.$i.']', "", $tpl->copy_template ); $tpl->copy_template = str_replace( '[/xfimagelarge-'.$i.']', "", $tpl->copy_template ); } } $tpl->copy_template = preg_replace( "#\[xfimage-(.+?)\](.+?)\[/xfimage-(.+?)\]#is", "", $tpl->copy_template ); $tpl->copy_template = preg_replace( "#\\{xfimage-(.+?)\\}#i", "{THEME}/dleimages/no_image.jpg", $tpl->copy_template ); $tpl->copy_template = preg_replace( "#\[xfimagelarge-(.+?)\](.+?)\[/xfimagelarge-(.+?)\]#is", "", $tpl->copy_template ); $tpl->copy_template = preg_replace( "#\\{xfimagelarge-(.+?)\\}#i", "{THEME}/dleimages/no_image.jpg", $tpl->copy_template ); } где screens меняет на название своего доп поля, где у нас загружены картинки. 2. В шаблоне fullstory.tpl прописываем код аналогичный этому: [xfimage-1]<a href="{xfimagelarge-1}" rel="highslide" class="highslide"><img src="{poster src='{xfimagelarge-1}' width='187' height='143'}" alt='{title}' title='{title}' /></a>[/xfimage-1][xfimage-2]<a href="{xfimagelarge-2}" rel="highslide" class="highslide"><img src="{poster src='{xfimagelarge-2}' width='187' height='143'}" alt='{title}' title='{title}' /></a>[/xfimage-2][xfimage-3]<a href="{xfimagelarge-3}" rel="highslide" class="highslide"><img src="{poster src='{xfimagelarge-3}' width='187' height='143'}" alt='{title}' title='{title}' /></a>[/xfimage-3] Проверено на 11.0-11.3
Для публикации сообщений создайте учётную запись или авторизуйтесь