Jump to content
Дизайн и модификация IPS Community IPBSkinsBETA
Search In
  • More options...
Find results that contain...
Find results in...
Sign in to follow this  
avgaz

Вывод данных

Recommended Posts

Спасибо, а как сделать рабочим управление блоками?

Блоки доступны при \IPS\Dispatcher\Front::i();, который не будет работать.

Можно вытащить из БД.

 

И ещё можно как то отключить адаптацию на таких страницах, но что бы на других она работала?

Это настройка темы "Enable responsiveness"?

Пробуйте

\IPS\Theme::i()->settings['responsive'] = 0;

Share this post


Link to post
Share on other sites

Блоки доступны при \IPS\Dispatcher\Front::i();, который не будет работать.

Можно вытащить из БД.

 

Это настройка темы "Enable responsiveness"?

Пробуйте

\IPS\Theme::i()->settings['responsive'] = 0;

 

То есть, на таких страницах не получится сделать управления блоками(виджетами)которые добавляются в боковую панель?

 

\IPS\Theme::i()->settings['responsive'] = 0;

так не работает ((

 

Ещё вопрос, вот я добавил ссылку(вкладку) в меню на такую страницу, но при просмотре этой странице в навигации активна вкладка форума(сообщество), можно как то сделать что бы была активна вкладка этой страницы?

Share this post


Link to post
Share on other sites

@avgaz, велосипед изобретаете. Используйте приложение Pages, для создания таких страниц. Будет у вас и режим конструктора, и активная вкладка.

Share this post


Link to post
Share on other sites

Подниму тему, может кто в курсе как на таких страницах вывести рекламу по ключу?

вот например в рекламе создан баннер с ключом 123 то есть в шаблон нужно вставлять {advertisement="123"} но вот как сделать что бы в содержимом страницы это распознавалось то есть в этом

<?php

require_once '/init.php';
\IPS\Dispatcher\External::i();
\IPS\Dispatcher\Build::i();
$content = '{advertisement="123"}';
\IPS\Output::i()->sendOutput( \IPS\Theme::i()->getTemplate( 'global', 'core' )->globalTemplate( 'Page Title', $content, array( 'app' => \IPS\Dispatcher::i()->application->directory, 'module' => \IPS\Dispatcher::i()->module->key, 'controller' => \IPS\Dispatcher::i()->controller ) ) );

?>

Share this post


Link to post
Share on other sites

может кто в курсе как на таких страницах вывести рекламу по ключу?

Например так

$advert = \IPS\core\Advertisement::loadByLocation('123');

Share this post


Link to post
Share on other sites

Например так

$advert = \IPS\core\Advertisement::loadByLocation('123');

А если на странице несколько баннеров?

Share this post


Link to post
Share on other sites

А если на странице несколько баннеров?

А в чем разница?

$advert2 = \IPS\core\Advertisement::loadByLocation('222');

Share this post


Link to post
Share on other sites

А в чем разница?

$advert2 = \IPS\core\Advertisement::loadByLocation('222');

Дак дважды запрашивается функция и дважды делается запрос в БД в ней, а если баннеров на странице 5 или 10, просто вроде на форуме делается один запрос в БД на вывод рекламы не зависимо сколько баннеров на странице

Share this post


Link to post
Share on other sites

и дважды делается запрос в БД в ней

1 запрос

Share this post


Link to post
Share on other sites

Спасибо действительно 1 запрос подскажите а почему вот так не срабатывает? не как не пойму вроде замена происходит нормально но баннеров нет ((

$content = '{advertisement="123"}test{advertisement="555"}';
$content = preg_replace('/{advertisement="(.*?)"}/i', \IPS\core\Advertisement::loadByLocation( "\\1" ), $content);

Share this post


Link to post
Share on other sites
$content = preg_replace_callback(
'/{advertisement="(.*?)"}/i', 
function($match)
{ 
	return \IPS\core\Advertisement::loadByLocation($match[1]); 
}, 
   $content
);

  • Upvote 1

Share this post


Link to post
Share on other sites

Спасибо, вроде нормально так работает, остался вопрос как вытащить блоки на такие страницы? ну вот например блок последних тем Topic Feed или Who's Online

Share this post


Link to post
Share on other sites
как вытащить блоки на такие страницы? ну вот например блок последних тем Topic Feed или Who's Online

Блоки Pages:

$block = \IPS\cms\Blocks\Block::display( $id );

 

Виджет "Topic Feed" без использования блоков Pages:

$widget1 = \IPS\Widget::load( \IPS\Application::load( 'forums' ), 'topicFeed', uniqid(), array() );
$output .= (string) $widget1;

 

Who's Online:

$widget2 = \IPS\Widget::load( \IPS\Application::load( 'core' ), 'whosOnline', uniqid(), array() );
$output .= (string) $widget2;

 

P.S. Стили, яваскрипт, если они используются блоками, тоже нужно подключать, естественно.

Share this post


Link to post
Share on other sites

Dmitriy427 а при этом виджеты не кешируются? а то добавляю тот же виджет Topic Feed на форум добавляется 1 запрос в БД, а вот если его добавить как вы выше написали на отдельную страницу так сразу 17 запросов в БД как бы многовато что то (((

Вот запросы без виджета

6
(read): SELECT * FROM `ibf_core_sessions` AS `core_sessions`  LEFT JOIN `ibf_core_members` AS `core_members` ON core_members.member_id=core_sessions.member_id WHERE id='rdvdpm156olb8soojs3j05rt97'

(read): SELECT * FROM `ibf_core_advertisements` AS `core_advertisements` WHERE ad_active=1 AND ad_start < 1500908593 AND ( ad_end=0 OR ad_end > 1500908593 )

(read): SELECT COUNT(*) FROM `ibf_core_rc_index` AS `core_rc_index` WHERE ( perm_id IN (SELECT perm_id FROM `ibf_core_permission_index` AS `core_permission_index` WHERE ( FIND_IN_SET(4,perm_view) OR FIND_IN_SET(14,perm_view) ) OR perm_view='*') OR perm_id IS NULL ) AND status IN( 1,2 ) AND ( class IN('IPS\\core\\Messenger\\Conversation','IPS\\core\\Messenger\\Message','IPS\\core\\Statuses\\Status','IPS\\core\\Statuses\\Reply','IPS\\forums\\Topic','IPS\\forums\\Topic\\Post','IPS\\forums\\Topic\\ArchivedPost','IPS\\gallery\\Image','IPS\\gallery\\Image\\Comment','IPS\\gallery\\Image\\Review','IPS\\gallery\\Album\\Item','IPS\\gallery\\Album\\Comment','IPS\\gallery\\Album\\Review') )

(read): SELECT word_key, word_default, word_custom FROM `ibf_core_sys_lang_words` AS `core_sys_lang_words` WHERE lang_id=2 AND word_key IN('advertisement_alt','jump_to_content_desc','jump_to_content','license_error_none','license_error_admin','create_menu_title','create_menu','add_announcement','announcement','status_update','saved','member_status','select_forum','topic','gallery_image','userbar_notifications','notification_options','notifications','see_all_notifications','userbar_messages','compose_new','message_sent','inbox','go_to_inbox','userbar_reports','report_center_header','report_center_link','view_user_profile','menu_content','view_my_profile','menu_profile','my_attachments','menu_settings_title','menu_followed_content','edit_account_settings','menu_settings','menu_manage_ignore','menu_modcp','menu_admincp','sign_out','search_everything','advanced_search','search_placeholder','menu_item_1','frontnavigation_forums','frontnavigation_gallery','staff','online_users','leaderboard_title','more','menu_item_2','all_activity','your_activity_streams','default_streams','stream_title_1','stream_title_2','stream_title_3','stream_title_4','stream_title_5','create_new_stream','search','mark_site_read','mark_site_read_button','home','contact_sent_blurb','contact','manage_blocks','copyright_line_value','mobile_menu_account','mobile_menu_back') and word_js=0

(write): REPLACE INTO `ibf_core_sessions` ( `id`, `member_name`, `seo_name`, `member_id`, `ip_address`, `browser`, `running_time`, `login_type`, `member_group`, `current_appcomponent`, `current_module`, `current_controller`, `current_id`, `uagent_key`, `uagent_version`, `uagent_type`, `search_thread_id`, `search_thread_time`, `data`, `location_url`, `location_lang`, `location_data`, `location_permissions`, `theme_id` ) VALUES ( 'rdvdpm156olb8soojs3j05rt97', 'Дмитрий', 'dmitrii', 2, '127.0.0.1', 'Mozilla/5.0 (Windows NT 6.1; WOW64; rv:54.0) Gecko/20100101 Firefox/54.0', 1500908593, 0, 4, 'forums', 'forums', 'index', 0, 'Firefox', '54.0', 'browser', 0, 0, '', 'http://dle.ru/forum/', 'loc_forums_index', '[]', '*', 0 )

(write): SELECT * FROM `ibf_core_tasks` AS `core_tasks` WHERE next_run<1500908653 AND enabled=1 ORDER BY next_run ASC

а вот с виджетом

23

(read): SELECT * FROM `ibf_core_sessions` AS `core_sessions`  LEFT JOIN `ibf_core_members` AS `core_members` ON core_members.member_id=core_sessions.member_id WHERE id='rdvdpm156olb8soojs3j05rt97'

(read): SELECT perm_type_id FROM `ibf_core_permission_index` AS `core_permission_index`  STRAIGHT_JOIN `ibf_forums_forums` AS `forums_forums` ON forums_forums.password IS NULL AND forums_forums.can_view_others=1 AND ( forums_forums.password IS NULL OR ( FIND_IN_SET(4,forums_forums.password_override) OR FIND_IN_SET(14,forums_forums.password_override) ) ) AND forums_forums.min_posts_view<=2798 AND core_permission_index.perm_type_id=forums_forums.id WHERE core_permission_index.app='forums' AND core_permission_index.perm_type='forum' AND (( FIND_IN_SET(4,perm_2) OR FIND_IN_SET(14,perm_2) OR FIND_IN_SET('m2',perm_2) ) OR perm_2='*' )

(read): SELECT forums_topics.*, core_tags_cache.tag_cache_text FROM `ibf_forums_topics` AS `forums_topics`  LEFT JOIN `ibf_forums_forums` AS `forums_forums` ON forums_topics.forum_id=forums_forums.id  LEFT JOIN `ibf_core_tags_cache` AS `core_tags_cache` ON tag_cache_key=MD5(CONCAT('forums;forums;',forums_topics.tid)) WHERE forums_topics.approved < 2 AND forums_topics.approved!=-2 AND ( NULLIF(forums_topics.moved_to, '') IS NULL ) AND forums_topics.forum_id IN(1,2,3,4,5,6,7,8,11,12,13,14,15,16,17,18,21,22,23,24,26,28,29,30,31,32,33,34,35,36,38,39,40,41,51,52,53,54,55,56,58,59,60,61,62,63,65,68,70,71,72,73,74,75,76,77,78,79,80,81,82,83) ORDER BY last_post DESC LIMIT 5

(read): SELECT * FROM `ibf_core_members` AS `core_members` WHERE ( member_id IN(9783,2,17395,47922,65178,2160,93404,95358,82642) )

(read): SELECT forums_forums.*, core_permission_index.perm_id, core_permission_index.perm_view, core_permission_index.perm_2, core_permission_index.perm_3, core_permission_index.perm_4, core_permission_index.perm_5, core_permission_index.perm_6, core_permission_index.perm_7 FROM `ibf_forums_forums` AS `forums_forums`  LEFT JOIN `ibf_core_permission_index` AS `core_permission_index` ON core_permission_index.app='forums' AND core_permission_index.perm_type='forum' AND core_permission_index.perm_type_id=forums_forums.id WHERE forums_forums.id=23

(read): SELECT * FROM `ibf_core_item_markers` AS `core_item_markers` WHERE item_member_id=2 AND item_app='forums'

(read): SELECT forums_forums.*, core_permission_index.perm_id, core_permission_index.perm_view, core_permission_index.perm_2, core_permission_index.perm_3, core_permission_index.perm_4, core_permission_index.perm_5, core_permission_index.perm_6, core_permission_index.perm_7 FROM `ibf_forums_forums` AS `forums_forums`  LEFT JOIN `ibf_core_permission_index` AS `core_permission_index` ON core_permission_index.app='forums' AND core_permission_index.perm_type='forum' AND core_permission_index.perm_type_id=forums_forums.id WHERE forums_forums.id=42

(read): SELECT forums_forums.*, core_permission_index.perm_id, core_permission_index.perm_view, core_permission_index.perm_2, core_permission_index.perm_3, core_permission_index.perm_4, core_permission_index.perm_5, core_permission_index.perm_6, core_permission_index.perm_7 FROM `ibf_forums_forums` AS `forums_forums`  LEFT JOIN `ibf_core_permission_index` AS `core_permission_index` ON core_permission_index.app='forums' AND core_permission_index.perm_type='forum' AND core_permission_index.perm_type_id=forums_forums.id WHERE forums_forums.id=56

(read): SELECT forums_forums.*, core_permission_index.perm_id, core_permission_index.perm_view, core_permission_index.perm_2, core_permission_index.perm_3, core_permission_index.perm_4, core_permission_index.perm_5, core_permission_index.perm_6, core_permission_index.perm_7 FROM `ibf_forums_forums` AS `forums_forums`  LEFT JOIN `ibf_core_permission_index` AS `core_permission_index` ON core_permission_index.app='forums' AND core_permission_index.perm_type='forum' AND core_permission_index.perm_type_id=forums_forums.id WHERE forums_forums.id=1

(read): SELECT forums_forums.*, core_permission_index.perm_id, core_permission_index.perm_view, core_permission_index.perm_2, core_permission_index.perm_3, core_permission_index.perm_4, core_permission_index.perm_5, core_permission_index.perm_6, core_permission_index.perm_7 FROM `ibf_forums_forums` AS `forums_forums`  LEFT JOIN `ibf_core_permission_index` AS `core_permission_index` ON core_permission_index.app='forums' AND core_permission_index.perm_type='forum' AND core_permission_index.perm_type_id=forums_forums.id WHERE forums_forums.id=51

(read): SELECT * FROM `ibf_core_item_markers` AS `core_item_markers` WHERE item_key='16d137cf4db00fb354a05b523a08bc4c' AND item_member_id=2 AND item_app='forums'

(read): SELECT forums_forums.*, core_permission_index.perm_id, core_permission_index.perm_view, core_permission_index.perm_2, core_permission_index.perm_3, core_permission_index.perm_4, core_permission_index.perm_5, core_permission_index.perm_6, core_permission_index.perm_7 FROM `ibf_forums_forums` AS `forums_forums`  LEFT JOIN `ibf_core_permission_index` AS `core_permission_index` ON core_permission_index.app='forums' AND core_permission_index.perm_type='forum' AND core_permission_index.perm_type_id=forums_forums.id WHERE forums_forums.id=44

(read): SELECT forums_forums.*, core_permission_index.perm_id, core_permission_index.perm_view, core_permission_index.perm_2, core_permission_index.perm_3, core_permission_index.perm_4, core_permission_index.perm_5, core_permission_index.perm_6, core_permission_index.perm_7 FROM `ibf_forums_forums` AS `forums_forums`  LEFT JOIN `ibf_core_permission_index` AS `core_permission_index` ON core_permission_index.app='forums' AND core_permission_index.perm_type='forum' AND core_permission_index.perm_type_id=forums_forums.id WHERE forums_forums.id=33

(read): SELECT * FROM `ibf_core_item_markers` AS `core_item_markers` WHERE item_key='a27da7ded3a0abefa2b2ec9fc946d63e' AND item_member_id=2 AND item_app='forums'

(read): SELECT forums_forums.*, core_permission_index.perm_id, core_permission_index.perm_view, core_permission_index.perm_2, core_permission_index.perm_3, core_permission_index.perm_4, core_permission_index.perm_5, core_permission_index.perm_6, core_permission_index.perm_7 FROM `ibf_forums_forums` AS `forums_forums`  LEFT JOIN `ibf_core_permission_index` AS `core_permission_index` ON core_permission_index.app='forums' AND core_permission_index.perm_type='forum' AND core_permission_index.perm_type_id=forums_forums.id WHERE forums_forums.id=46

(read): SELECT word_key, word_default, word_custom FROM `ibf_core_sys_lang_words` AS `core_sys_lang_words` WHERE lang_id=2 AND word_key IN('topic_pl','go_to_page_x','go_to_page_x','go_to_page_x','go_to_page_x','last_page','view_user_profile','byline','f_years_short','_date_last_year_long','in','forums_forum_23','forums_comments','num_views','view_user_profile','get_last_post','_date_this_year_short','_date_this_year_long','pinned','view_user_profile','byline','f_years_short','_date_last_year_long','forums_forum_56','forums_comments','num_views','view_user_profile','_date_this_year_short','_date_this_year_long','view_user_profile','byline','f_years_short','_date_last_year_long','forums_comments','num_views','view_user_profile','byline','_date_last_year_long','forums_forum_51','forums_comments','num_views','view_user_profile','view_user_profile','byline','_date_this_year_short','_date_this_year_long','forums_forum_33','forums_comments','num_views','view_user_profile') and word_js=0

(read): SELECT * FROM `ibf_core_widgets` AS `core_widgets` WHERE `key`='topicFeed' AND app='forums'

(write): UPDATE `ibf_core_widgets` core_widgets  SET `caches`='{"widget_topicFeed_59760c0820241_af66ff4dd6fc24e08563f93f435d1302":1500908552,"widget_topicFeed_59760caaee45c_af66ff4dd6fc24e08563f93f435d1302":1500908715}' WHERE `key`='topicFeed' AND app='forums' 

(read): SELECT * FROM `ibf_core_advertisements` AS `core_advertisements` WHERE ad_active=1 AND ad_start < 1500908715 AND ( ad_end=0 OR ad_end > 1500908715 )

(read): SELECT COUNT(*) FROM `ibf_core_rc_index` AS `core_rc_index` WHERE ( perm_id IN (SELECT perm_id FROM `ibf_core_permission_index` AS `core_permission_index` WHERE ( FIND_IN_SET(4,perm_view) OR FIND_IN_SET(14,perm_view) ) OR perm_view='*') OR perm_id IS NULL ) AND status IN( 1,2 ) AND ( class IN('IPS\\core\\Messenger\\Conversation','IPS\\core\\Messenger\\Message','IPS\\core\\Statuses\\Status','IPS\\core\\Statuses\\Reply','IPS\\forums\\Topic','IPS\\forums\\Topic\\Post','IPS\\forums\\Topic\\ArchivedPost','IPS\\gallery\\Image','IPS\\gallery\\Image\\Comment','IPS\\gallery\\Image\\Review','IPS\\gallery\\Album\\Item','IPS\\gallery\\Album\\Comment','IPS\\gallery\\Album\\Review') )

(read): SELECT word_key, word_default, word_custom FROM `ibf_core_sys_lang_words` AS `core_sys_lang_words` WHERE lang_id=2 AND word_key IN('advertisement_alt','jump_to_content_desc','jump_to_content','license_error_none','license_error_admin','create_menu_title','create_menu','add_announcement','announcement','status_update','saved','member_status','select_forum','topic','gallery_image','userbar_notifications','notification_options','notifications','see_all_notifications','userbar_messages','compose_new','message_sent','inbox','go_to_inbox','userbar_reports','report_center_header','report_center_link','menu_content','view_my_profile','menu_profile','my_attachments','menu_settings_title','menu_followed_content','edit_account_settings','menu_settings','menu_manage_ignore','menu_modcp','menu_admincp','sign_out','search_everything','advanced_search','search_placeholder','menu_item_1','frontnavigation_forums','frontnavigation_gallery','staff','online_users','leaderboard_title','more','menu_item_2','all_activity','your_activity_streams','default_streams','stream_title_1','stream_title_2','stream_title_3','stream_title_4','stream_title_5','create_new_stream','search','mark_site_read','mark_site_read_button','home','contact_sent_blurb','contact','manage_blocks','copyright_line_value','mobile_menu_account','mobile_menu_back') and word_js=0

(write): REPLACE INTO `ibf_core_sessions` ( `id`, `member_name`, `seo_name`, `member_id`, `ip_address`, `browser`, `running_time`, `login_type`, `member_group`, `current_appcomponent`, `current_module`, `current_controller`, `current_id`, `uagent_key`, `uagent_version`, `uagent_type`, `search_thread_id`, `search_thread_time`, `data`, `location_url`, `location_lang`, `location_data`, `location_permissions`, `theme_id` ) VALUES ( 'rdvdpm156olb8soojs3j05rt97', 'Дмитрий', 'dmitrii', 2, '127.0.0.1', 'Mozilla/5.0 (Windows NT 6.1; WOW64; rv:54.0) Gecko/20100101 Firefox/54.0', 1500908714, 0, 4, 'forums', 'forums', 'index', 0, 'Firefox', '54.0', 'browser', 0, 0, '', 'http://dle.ru/forum/', 'loc_forums_index', '[]', '*', 0 )

(write): SELECT * FROM `ibf_core_tasks` AS `core_tasks` WHERE next_run<1500908775 AND enabled=1 ORDER BY next_run ASC

Share this post


Link to post
Share on other sites

Поэтому я вам дал блоки Pages, в первую очередь. Создавайте блок на базе виджета, выставляйте настройки кеширования, будет вам один запрос.

Share this post


Link to post
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...