Trotor Posted January 22, 2019 Share Posted January 22, 2019 Помогите составить условие, в котором контент отображался бы при наличие обновлений в том или ином разделе или теме форума (вне зависимости подписан пользователь на этот раздел или тему), и которое бы помещалось в шаблон hookWatchedItems. <if test="updatedforums:|:$r['id'] == 1">КОНТЕНТ</if> Link to comment Share on other sites More sharing options...
siv1987 Posted January 22, 2019 Share Posted January 22, 2019 В шаблоне есть 4 входящие переменные типа array. Может быть это то что вам нужно. Что это за шаблон и что находятся в этих переменных я понятие не имею. $updatedTopics, $nUpdatedTopics, $updatedForums, $nUpdatedForums <if test="is_array( $updatedForums ) AND count( $updatedForums )"> КОНТЕНТ </if> Link to comment Share on other sites More sharing options...
Trotor Posted January 22, 2019 Author Share Posted January 22, 2019 В шаблоне есть 4 входящие переменные типа array. Может быть это то что вам нужно.А как именно указать идентификатор того или иного раздела или темы? Что это за шаблон и что находятся в этих переменных я понятие не имею.Это шаблон хука отвечающий за вывод в боковую панель на главной списка обновлений разделов и тем на которых подписан пользователь. Официальный хук от IPS.Он у меня отображается на всех страницах форума, видоизменил его. Вот дефолтный шаблон:hookWatchedItems.zip Вот сам хук:watched_items.zip Link to comment Share on other sites More sharing options...
newbie Posted January 23, 2019 Share Posted January 23, 2019 А как именно указать идентификатор того или иного раздела или темы?$updatedTopics[1], $nUpdatedTopics[2], $updatedForums[5], $nUpdatedForums[12] Link to comment Share on other sites More sharing options...
Trotor Posted January 23, 2019 Author Share Posted January 23, 2019 <if test="is_array( $updatedForums ) AND count( $updatedForums )">КОНТЕНТ</if> В такой конструкции не работает:<if test="is_array( $updatedForums[1] ) AND count( $updatedForums[1] )">КОНТЕНТ</if> Link to comment Share on other sites More sharing options...
siv1987 Posted January 23, 2019 Share Posted January 23, 2019 Ключ массива (1) - это id форума для $updatedForums, и соответственно темы для $updatedTopics Link to comment Share on other sites More sharing options...
Trotor Posted January 23, 2019 Author Share Posted January 23, 2019 Ключ массива (1) - это id форума для $updatedForums, и соответственно темы для $updatedTopics Всё равно не понял как конструкцию такую собрать. Link to comment Share on other sites More sharing options...
newbie Posted January 24, 2019 Share Posted January 24, 2019 1. print_r всех переменных при одном условии2. print_r всех переменных при втором условии3. Сравниваете результаты, на основании которых составляете условие (если возможно) Link to comment Share on other sites More sharing options...
Trotor Posted January 24, 2019 Author Share Posted January 24, 2019 1. print_r всех переменных при одном условии2. print_r всех переменных при втором условииНичего не понял. Можно подробную конструкцию? :) Link to comment Share on other sites More sharing options...
newbie Posted January 25, 2019 Share Posted January 25, 2019 http://php.net/manual/ru/function.print-r.phpУ Вас есть 2 условия1. Когда есть обновления2. Когда нет обновлений Сначала получаете значения всех переменных шаблона при первом условии. Затем при втором. Ищите различия Link to comment Share on other sites More sharing options...
Trotor Posted January 25, 2019 Author Share Posted January 25, 2019 http://php.net/manua...ion.print-r.phpИнструкция понятно для тех людей которые разбираются в php. Есть пример:<?php$b = array ('m' => 'monkey', 'foo' => 'bar', 'x' => array ('x', 'y', 'z'));$results = print_r($b, true); // $results теперь содержит вывод print_r?>Во первых как и куда мне переменные нужные поставить. Во вторых куда затем этот php-код вставлять, и в третих - где будет показ результатов? Link to comment Share on other sites More sharing options...
siv1987 Posted January 25, 2019 Share Posted January 25, 2019 Если не работает значит такое условие составить нельзя, либо нужно глубже капать этот шаблон. Link to comment Share on other sites More sharing options...
Trotor Posted January 25, 2019 Author Share Posted January 25, 2019 Если не работает значит такое условие составить нельзяТак в том то и дело что я не знаю как его составить. Подскажите мне на примере и буду пробовать. Это мне в будущем понадобиться для составления таких запросов. Link to comment Share on other sites More sharing options...
newbie Posted January 26, 2019 Share Posted January 26, 2019 Во первых как и куда мне переменные нужные поставить. Во вторых куда затем этот php-код вставлять, и в третих - где будет показ результатов? В шаблон.<php> print_r($updatedTopics); print_r($nUpdatedTopics); print_r($updatedForums); print_r($nUpdatedForums); </php> 1 Link to comment Share on other sites More sharing options...
Trotor Posted January 26, 2019 Author Share Posted January 26, 2019 В шаблон.Спасибо. Я так понял что это блок можно использовать и для остальных шаблонов для проверки переменных? Теперь по теме.Вот такое выдало: Array ( ) Array ( ) Array ( ) Array ( [1] => Array ( [forum_id] => 1 [last_sent] => 1545582764 [member_id] => 1 [id] => 1 [topics] => 30 [posts] => 11978 [last_post] => 1548208641 [last_poster_id] => 1 [last_poster_name] => Haktar [name] => Имперский Атриум [description] => Вопросы и предложения, полезная информация, извещения о изменениях на форуме. [position] => 1 [use_ibc] => 1 [use_html] => 1 [status] => 1 [password] => [password_override] => [last_title] => Глобальный Р ейтинг Форумчан [last_id] => 40759 [sort_key] => last_post [sort_order] => Z-A [prune] => 100 [topicfilter] => all [show_rules] => 2 [preview_posts] => 0 [allow_poll] => 1 [allow_pollbump] => 0 [inc_postcount] => 0 [skin_id] => [parent_id] => 1287 [sub_can_post] => 1 [quick_reply] => 1 [redirect_url] => [redirect_on] => 0 [redirect_hits] => 0 [rules_title] => [rules_text] => <a href='/topic/33-sovety-pozhelaniya-i-voprosy-po-forumu/' target='_blank'><img src='/grafik/help.png' class='photo'/> Вопросы по Форуму</a><span class='right' style='margin-right: -5px'><a href='/index.php?app=core&module=help' target='_blank'>Помощь по Форуму <img src='/grafik/information.png' class='photo'/></a></span> [notify_modq_emails] => [permission_custom_error] => [permission_showtopic] => 0 [queued_topics] => 0 [queued_posts] => 0 [forum_last_deletion] => 1545912936 [forum_allow_rating] => 1 [newest_title] => Новогодняя амнистия! [newest_id] => 55227 [can_view_others] => 1 [min_posts_post] => 0 [min_posts_view] => 0 [hide_last_info] => 0 [name_seo] => imperskii-atrium [seo_last_title] => globalnyi-reiting-forumchan [seo_last_name] => haktar [last_x_topic_ids] => a:5:{i:55227;s:10:"1545582764";i:54881;s:10:"1542081045";i:54513;s:10:"1538552220";i:53961;s:10:"1533246305";i:53692;s:10:"1530718655";} [forums_bitoptions] => 0 [disable_sharelinks] => 0 [deleted_posts] => 0 [deleted_topics] => 0 [rules_raw_html] => 0 [eco_tpc_pts] => 0.00 [eco_rply_pts] => 0.00 [eco_get_rply_pts] => 0.00 [icon] => br09 [perm_id] => 4224 [app] => forums [perm_type] => forum [perm_type_id] => 1 [perm_view] => 125,121,2,6,4,96,8,11,61 [perm_2] => ,125,121,6,4,96,8,11,61, [perm_3] => ,125,121,6,4,96,8,11,61, [perm_4] => ,6,4,11, [perm_5] => ,125,121,6,4,96,11,61, [perm_6] => ,125,121,6,4,96,8,11,61, [perm_7] => ,, [owner_only] => 0 [friend_only] => 0 [authorized_users] => [perm_read] => 125,121,6,4,96,8,11,61 [perm_reply] => 125,121,6,4,96,8,11,61 [perm_start] => 6,4,11 [perm_upload] => 125,121,6,4,96,11,61 [perm_download] => 125,121,6,4,96,8,11,61 [fid] => 1 ) [1239] => Array ( [forum_id] => 1239 [last_sent] => 1543621297 [member_id] => 1 [id] => 1239 [topics] => 9 [posts] => 2745 [last_post] => 1546273651 [last_poster_id] => 1 [last_poster_name] => Haktar [name] => Имперская Префектура [description] => Имперская Префектура - служебный раздел для Префектов и Трибунов Сообщества Империал. [position] => 1237 [use_ibc] => 1 [use_html] => 1 [status] => 1 [password] => [password_override] => [last_title] => Имперская Префектура [last_id] => 45986 [sort_key] => last_post [sort_order] => Z-A [prune] => 100 [topicfilter] => all [show_rules] => [preview_posts] => 0 [allow_poll] => 1 [allow_pollbump] => 0 [inc_postcount] => 0 [skin_id] => [parent_id] => 650 [sub_can_post] => 1 [quick_reply] => 1 [redirect_url] => [redirect_on] => 0 [redirect_hits] => 0 [rules_title] => [rules_text] => [notify_modq_emails] => 0 [permission_custom_error] => [permission_showtopic] => 0 [queued_topics] => 0 [queued_posts] => 0 [forum_last_deletion] => 1544108962 [forum_allow_rating] => 0 [newest_title] => Префиксы в Названиях тем [newest_id] => 55024 [can_view_others] => 1 [min_posts_post] => 0 [min_posts_view] => 0 [hide_last_info] => 0 [name_seo] => imperskaya-prefektura [seo_last_title] => imperskaya-prefektura [seo_last_name] => haktar [last_x_topic_ids] => a:5:{i:55024;s:10:"1543331766";i:54809;s:10:"1541436911";i:52226;s:10:"1521059899";i:51549;s:10:"1516909730";i:46875;s:10:"1482780961";} [forums_bitoptions] => 0 [disable_sharelinks] => 1 [deleted_posts] => 0 [deleted_topics] => 0 [rules_raw_html] => 0 [eco_tpc_pts] => 0.00 [eco_rply_pts] => 0.00 [eco_get_rply_pts] => 0.00 [icon] => br(33).png [perm_id] => 3633 [app] => forums [perm_type] => forum [perm_type_id] => 1239 [perm_view] => 141,4,11,124 [perm_2] => ,141,4,11,124, [perm_3] => ,141,4,11,124, [perm_4] => ,141,4,11,124, [perm_5] => ,141,4,11,124, [perm_6] => ,141,4,11,124, [perm_7] => ,, [owner_only] => 0 [friend_only] => 0 [authorized_users] => [perm_read] => 141,4,11,124 [perm_reply] => 141,4,11,124 [perm_start] => 141,4,11,124 [perm_upload] => 141,4,11,124 [perm_download] => 141,4,11,124 [fid] => 1239 ) [439] => Array ( [forum_id] => 439 [last_sent] => 1539887951 [member_id] => 1 [id] => 439 [topics] => 17 [posts] => 1276 [last_post] => 1546754331 [last_poster_id] => 83346 [last_poster_name] => Valerius [name] => Europa Universalis IV (Европа IV) [description] => Серия игровой линейки Europa Universalis (Европа Универсалис)отличается стратегической глубиной и исторической достоверностью. [position] => 2 [use_ibc] => 1 [use_html] => 1 [status] => 1 [password] => [password_override] => [last_title] => Europa Universalis IV (Европа IV) [last_id] => 21030 [sort_key] => last_post [sort_order] => Z-A [prune] => 100 [topicfilter] => all [show_rules] => 2 [preview_posts] => 0 [allow_poll] => 1 [allow_pollbump] => 0 [inc_postcount] => 1 [skin_id] => [parent_id] => 314 [sub_can_post] => 1 [quick_reply] => 1 [redirect_url] => [redirect_on] => 0 [redirect_hits] => 0 [rules_title] => [rules_text] => <a href='/links/category/252-europa-universalis-iv-европа-iv/' target='_blank'>Скачать файлы Europa Universalis IV (Европа IV)</a><span class='right' style='margin-right: -5px'><a href='/tutorials/category/30-europa-universalis-iv-европа-iv/' target='_blank'>Статьи о Europa Universalis IV (Европа IV)</a></span> [notify_modq_emails] => 0 [permission_custom_error] => [permission_showtopic] => 0 [queued_topics] => 0 [queued_posts] => 0 [forum_last_deletion] => 1542840575 [forum_allow_rating] => 1 [newest_title] => Europa Universalis: The Board Game [newest_id] => 54651 [can_view_others] => 1 [min_posts_post] => 0 [min_posts_view] => 0 [hide_last_info] => 0 [name_seo] => europa-universalis-iv-evropa-iv [seo_last_title] => europa-universalis-iv-evropa-iv [seo_last_name] => valerius [last_x_topic_ids] => a:5:{i:54651;s:10:"1539887951";i:50891;s:10:"1513044082";i:49255;s:10:"1496189835";i:46532;s:10:"1480862343";i:45102;s:10:"1471777125";} [forums_bitoptions] => 0 [disable_sharelinks] => 0 [deleted_posts] => 0 [deleted_topics] => 0 [rules_raw_html] => 0 [eco_tpc_pts] => 100.00 [eco_rply_pts] => 5.00 [eco_get_rply_pts] => 2.00 [icon] => br(122).png [perm_id] => 226 [app] => forums [perm_type] => forum [perm_type_id] => 439 [perm_view] => 2,6,8,11,4,61,96,121,125 [perm_2] => ,2,6,8,11,4,61,96,121,125, [perm_3] => ,6,8,11,4,61,96,121,125, [perm_4] => ,6,11,4,96,121,125, [perm_5] => ,6,11,4,61,96,121,125, [perm_6] => ,6,8,11,4,61,96,121,125, [perm_7] => ,, [owner_only] => 0 [friend_only] => 0 [authorized_users] => [perm_read] => 2,6,8,11,4,61,96,121,125 [perm_reply] => 6,8,11,4,61,96,121,125 [perm_start] => 6,11,4,96,121,125 [perm_upload] => 6,11,4,61,96,121,125 [perm_download] => 6,8,11,4,61,96,121,125 [fid] => 439 ) ) Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now