AHristich Posted March 3 Report Share Posted March 3 Парни,выручайте. В рнр я ноль ,ну может 0.1,не более. Есть код {{$location = $row != NULL ? $row : ($row->post != NULL ? $row->post : $row);}} {{$field_content = $row->post == NULL ? 'field_'.$location->database()->field_content : $row->post; $field_content = $row->post == NULL ? $location->$field_content : $field_content;}} {{if \preg_match( '#<fileStore.core_Attachment>\S+(?:jpg|jpeg|png|webp)#', $field_content, $image_url )}} {{$image_url = \str_replace('<fileStore.core_Attachment>', \IPS\File::getClass('core_Attachment')->baseUrl(), $image_url[0]);}} {{if settings.lazy_load_enabled}} <a href="{$row->url( "getPrefComment" )}" title="{lang="read_more_about" sprintf="$row->_title"}" > <img class='ipsImage' src='{expression="\IPS\Text\Parser::blankImage()"}' alt='{wordbreak="$row->_title"}' data-src='{file="$image_url" extension="core_Attachment"}'> </a> {{else}} <a href="{$row->url( "getPrefComment" )}" title="{lang="read_more_about" sprintf="$row->_title"}" > <img class='ipsImage' alt='{wordbreak="$row->_title"}' src='{file="$image_url" extension="core_Attachment"}'> </a> {{endif}} {{endif}} Работает в Страницах: entry и recordRow / и Форумах: topicRow и topicRowSnnipet. Но ни в какую не хотит фурыкать в файле forums/global/row P.S Автор кода молчит... Quote Link to comment Share on other sites More sharing options...
Desti Posted March 3 Report Share Posted March 3 попробуй поменять $row на $topic Quote Link to comment Share on other sites More sharing options...
AHristich Posted March 3 Author Report Share Posted March 3 2 минуты назад, Desti сказал: попробуй поменять $row на $topic здесь у меня подозрение на строку {{$field_content = $row->post == NULL ? 'field_'.$location->database()->field_content : $row->post; $field_content = $row->post == NULL ? $location->$field_content : $field_content;}} потому что без этой строки ошибки нету,но и сам код не работает как надо. Quote Link to comment Share on other sites More sharing options...
Desti Posted March 3 Report Share Posted March 3 50 минут назад, AHristich сказал: потому что без этой строки ошибки нету, но и сам код не работает как надо. А вам не приходит в голову, что немного совсем наоборот? Переменной $row нет в вашем шаблоне, чего вы хотите получить-то? В последний шаблон передается переменная $topic, ее и надо использовать. Quote Link to comment Share on other sites More sharing options...
AHristich Posted March 3 Author Report Share Posted March 3 3 минуты назад, Desti сказал: А вам не приходит в голову, что немного совсем наоборот? Переменной $row нет в вашем шаблоне, чего вы хотите получить-то? В последний шаблон передается переменная $topic, ее и надо использовать. Я в курсе что $row нету,поэтому использовал $topic (до создания темы о помощи) {{$location = $topic != NULL ? $topic : ($row->post != NULL ? $row->post : $row);}} {{$field_content = $row->post == NULL ? 'field_'.$location->database()->field_content : $row->post; $field_content = $row->post == NULL ? $location->$field_content : $field_content;}} {{if \preg_match( '#<fileStore.core_Attachment>\S+(?:jpg|jpeg|png|webp)#', $field_content, $image_url )}} {{$image_url = \str_replace('<fileStore.core_Attachment>', \IPS\File::getClass('core_Attachment')->baseUrl(), $image_url[0]);}} {{if settings.lazy_load_enabled}} <a href="{$topic->url( "getPrefComment" )}" title="{lang="read_more_about" sprintf="$topic->_title"}" > <img class='ipsImage' src='{expression="\IPS\Text\Parser::blankImage()"}' alt='{wordbreak="$topic->_title"}' data-src='{file="$image_url" extension="core_Attachment"}'></a> {{else}} <a href="{$topic->url( "getPrefComment" )}" title="{lang="read_more_about" sprintf="$topic->_title"}" > <img class='ipsImage' alt='{wordbreak="$topic->_title"}' src='{file="$image_url" extension="core_Attachment"}'></a> {{endif}} {{endif}} или я что-то не так делаю? даже пробывал полностью все $row в этом коде заменить на $topic,бесполезно. Quote Link to comment Share on other sites More sharing options...
Desti Posted March 3 Report Share Posted March 3 Все $row заменить на $topic. У вас даже в первой строке пара $row, реально не видите??? Quote Link to comment Share on other sites More sharing options...
Exception Posted March 3 Report Share Posted March 3 7 часов назад, AHristich сказал: Но ни в какую не хотит фурыкать в файле forums/global/row где у тебя этот табличный шаблон выводится? Quote Link to comment Share on other sites More sharing options...
AHristich Posted March 3 Author Report Share Posted March 3 46 минут назад, Exception сказал: где у тебя этот табличный шаблон выводится? Пытаюсь вывести в пользовательских блоках,там подключается этот шаблон. Тесть создаю блок в Страницах,затем шаблон блока Лента тем форумов,вот там и подключается этот шаблон. forums/global/row.html Quote Link to comment Share on other sites More sharing options...
AHristich Posted March 3 Author Report Share Posted March 3 1 час назад, Desti сказал: Все $row заменить на $topic. У вас даже в первой строке пара $row, реально не видите??? Это здесь не ту редакцию показал,менял абсолютно все $row Quote Link to comment Share on other sites More sharing options...
Exception Posted March 3 Report Share Posted March 3 можно первый пост загрузить с темы {{$post = $topic->topic_firstpost ? \IPS\forums\Topic\Post::load($topic->topic_firstpost)->post : NULL;}} {{if $post AND \preg_match( '#<fileStore.core_Attachment>\S+(?:jpg|jpeg|png|webp)#', $post, $image_url )}} {{$image_url = \str_replace('<fileStore.core_Attachment>', \IPS\File::getClass('core_Attachment')->baseUrl(), $image_url[0]);}} {{if settings.lazy_load_enabled}} <a href="{$topic->url( "getPrefComment" )}" title="{lang="read_more_about" sprintf="$topic->_title"}" > <img class='ipsImage' src='{expression="\IPS\Text\Parser::blankImage()"}' alt='{wordbreak="$topic->_title"}' data-src='{file="$image_url" extension="core_Attachment"}'></a> {{else}} <a href="{$topic->url( "getPrefComment" )}" title="{lang="read_more_about" sprintf="$topic->_title"}" > <img class='ipsImage' alt='{wordbreak="$topic->_title"}' src='{file="$image_url" extension="core_Attachment"}'></a> {{endif}} {{endif}} AHristich 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.