bon1 Posted March 19 Report Share Posted March 19 Добрый день форумчане, помогите исправить код, раньше все было хорошо пока не обновил CMS: есть вот такой код который выводит ссылки на загруженные изображения: //////////////////IMGES///////////////// $sql_poster = $db->query( "SELECT images, news_id FROM " . PREFIX . "_images where news_id = '{$row['id']}' LIMIT 2" ); $poster = $db->get_row($sql_poster); if ($poster['images'] != "") { $scrsList = explode('|||',$poster['images']); $scrs = ''; $cntscrs = 90; $ai = 0; foreach ($scrsList as $scr) { $ai++; $scr = trim($scr); $poster_temp = explode("/",$scr); $poster_name = $poster_temp[1]; $poster_data = substr($scr,0,8); if ($ai<=$cntscrs) { $scrs .= ' <a data-fancybox="gallery" class="swiper-slide swiper-slide-active" href="'. $config ['http_home_url'] . 'uploads/posts/'.$poster_data.''.$poster_name.'" role="group" aria-label="1 / 21" style="width: 926px; margin-right: 10px;"> <div class="swiper-slide ssr" style="background-image:url('. $config ['http_home_url'] . 'uploads/posts/'.$poster_data.$poster_name.')"></div> </a> '; } else { $scrs .= ''; } } unset($scrsList); if (!empty($poster['images'])) { $scrall= $scrs;} $tpl->set ( '{poster}', $scrall); } else $tpl->set ( '{poster}', "" ); /////////////////END//////////////// До обновления CMS ссылки выводились в таком формате https://site.ru/uploads/posts/2023-03/box_release.png После обновления CMS ссылки выводятся в таком формате https://site.ru/uploads/posts/2023-03/box_release.png|1|0|322x356|106.41 Kb|0 т.е. в конце прибавилась |1|0|322x356|106.41 Kb|0 Не могу решить проблему( Quote Link to comment Share on other sites More sharing options...
SlawkA Posted March 19 Report Share Posted March 19 34 минуты назад, bon1 сказал: т.е. в конце прибавилась |1|0|322x356|106.41 Kb|0 может после обновы в админке добавилась такая функция? которую можно отключить или как то настроить Quote Link to comment Share on other sites More sharing options...
bon1 Posted March 19 Author Report Share Posted March 19 5 минут назад, SlawkA сказал: может после обновы в админке добавилась такая функция? которую можно отключить или как то настроить Все прошерстил, нет ни чего такого, это сторонний код, который был кем то написан, он на прошлых версиях работал на новом не работает😩 Quote Link to comment Share on other sites More sharing options...
SlawkA Posted March 19 Report Share Posted March 19 bon1 но в коде я точно не вижу коды этого 322x356|106.41 Kb Quote Link to comment Share on other sites More sharing options...
by_ix Posted March 19 Report Share Posted March 19 @bon1 $poster_temp[1] - значит эта регулярка вводит теперь лишние данные. Quote Link to comment Share on other sites More sharing options...
bon1 Posted March 19 Author Report Share Posted March 19 10 минут назад, by_ix сказал: @bon1 $poster_temp[1] - значит эта регулярка вводит теперь лишние данные. Да да точно, читал в каком то сайте, но как решить данную проблему ?Может есть какие то мысли? Спойлер Вот тоже писали, но решения нет Quote Link to comment Share on other sites More sharing options...
by_ix Posted March 19 Report Share Posted March 19 как вариант: $poster_name = explode("|", $poster_temp[1]); $poster_name = $poster_name[0]; bon1 1 Quote Link to comment Share on other sites More sharing options...
bon1 Posted March 19 Author Report Share Posted March 19 8 минут назад, by_ix сказал: как вариант: $poster_name = explode("|", $poster_temp[1]); $poster_name = $poster_name[0]; Заработала, спасибо)🙃 by_ix 1 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.