Перейти к публикации
View in the app

A better way to browse. Learn more.

Дизайн и модификация Invision Community

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Как сделать IP.Content "корневым" приложением

Опубликовано:

Чтобы сделать IP.Content первым, что открывается по заходу на ваш IP.Board-форум, нужно выполнить 2 шага:

 

1. Поднять форум и все его страницы из корня в виртуальную подпапку "forums" с помощью правки ЧПУ-шаблонов

 

Заменяем содержимое файла /admin/applications/forums/extensions/furlTemplates.php на:

 

<?php
/**
* <pre>
* Invision Power Services
* IP.Board vVERSION_NUMBER
* Sets up SEO templates
* Last Updated: $Date: 2011-08-02 15:53:39 -0400 (Tue, 02 Aug 2011) $
* </pre>
*
* @author 		$Author: bfarber $
* @copyright	(c) 2001 - 2009 Invision Power Services, Inc.
* @license		http://www.invisionpower.com/community/board/license.html
* @package		IP.Board
* @subpackage	Forums
* @link		http://www.invisionpower.com
* @since		20th February 2002
* @version		$Rev: 9351 $
*
*/

if ( ! defined( 'IN_IPB' ) )
{
print "<h1>Incorrect access</h1>You cannot access this file directly. If you have recently upgraded, make sure you upgraded all the relevant files.";
exit();
}

/**
* SEO templates
*
* 'allowRedirect' is a flag to tell IP.Board whether to check the incoming link and if not formatted correctly, redirect the correct one
*
* OUT FORMAT REGEX:
* First array element is a regex to run to see if we've a match for the URL
* The second array element is the template to use the results of the parenthesis capture
*
* Special variable #{__title__} is replaced with the $title data passed to output->formatUrl( $url, $title)
*
* IMPORTANT: Remember that when these regex are used, the output has not been fully parsed so you will get:
* showuser={$data['member_id']} NOT showuser=1 so do not try and match numerics only!
*
* IN FORMAT REGEX
*
* This allows the registry to piece back together a URL based on the template regex
* So, for example: "/user/(\d+?)/", 'matches' => array(  array( 'showuser' => '$1' ) )tells IP.Board to populate 'showuser' with the result
* of the parenthesis capture #1
*/
$_SEOTEMPLATES = array(

'showannouncement'     => array( 'app'		     => 'forums',
								 'allowRedirect' => 1,
								 'out'           => array( '#showannouncement=(.+?)((?:&|&)f=(.+?))?(&|$)#i', 'forums/forum-$3/announcement-$1-#{__title__}/$4' ),
						  		 'in'            => array( 'regex'   => '#/forums/forum-(\d+?)?/announcement-(\d+?)-#i',
												 		   'matches' => array( array( 'showannouncement', '$2' ), array( 'f', '$1' ) ) ) ),

'showforum'     => array( 'app'		      => 'forums',
						  'allowRedirect' => 1,
						  'isPagesMode'   => 1,
						  'out'           => array( '#showforum=(.+?)(&|$)#i', 'forums/forum/$1-#{__title__}/$2' ),
						  'in'            => array( 'regex'   => '#^/forums/forum/(\d+?)-#i',
												    'matches' => array( array( 'showforum', '$1' ) ) ) ),

'showtopicunread'=> array( 'app'		      => 'forums',
						   'allowRedirect'    => 1,
						   'out'              => array( '#showtopic=(.+?)(?:&|&)view=getnewpost(&|$)#i', 'forums/topic/$1-#{__title__}/unread/$2' ),
						   'in'               => array( 'regex'   => '#^/forums/topic/(\d+?)-([^/]+?)/unread(/|$)#i',
											            'matches' => array( array( 'showtopic', '$1' ),
																			array( 'view', 'getnewpost' ) ) ) ),

'showtopicnextunread'=> array( 'app'		      => 'forums',
							   'allowRedirect'    => 1,
							   'out'              => array( '#showtopic=(.+?)(?:&|&)view=getnextunread(&|$)#i', 'forums/topic/$1-#{__title__}/nextunread/$2' ),
							   'in'               => array( 'regex'   => '#^/forums/topic/(\d+?)-([^/]+?)/nextunread(/|$)#i',
												            'matches' => array( array( 'showtopic', '$1' ),
																				array( 'view', 'getnextunread' ) ) ) ),

'showtopic'     => array( 'app'		      => 'forums',
						  'allowRedirect' => 1,
						  'isPagesMode'   => 1,
						  'out'           => array( '#showtopic=(.+?)(\#|&|$)#i', 'forums/topic/$1-#{__title__}/$2' ),
						  'in'            => array( 'regex'   => '#^/forums/topic/(\d+?)-#i',
											        'matches' => array( array( 'showtopic', '$1' ) ) ) ),

'acteqst'       => array( 'app'		      => 'forums',
						  'allowRedirect' => 1,
						  'out'           => array( '#act=ST(.*?)&t=(.+?)(&|$)#i', 'forums/topic/$2-#{__title__}/$3' ),
						  'in'            => array( 'regex'   => '#^notavalidrequest$#i',
											        'matches' => array( array( 'showtopic', '0' ) ) ) ),

'act=idx'       => array( 'app'		      => 'forums',
						  'allowRedirect' => 0,
						  'out'           => array( '#act=idx(&|$)#i', 'forums/$1' ),
						  'in'            => array( 'regex'   => '#^/forums(/|$|\?)#i',
											        'matches' => array( array( 'act', 'idx' ) ) ) ),
);

 

 

2. Назначать IP.Content основным приложением

 

Заменяем в /initdata.php это:

 

/**
* Default app name
* You can set this in your own scripts before 'initdata.php' is required.
*/
if ( ! defined( 'IPS_DEFAULT_PUBLIC_APP' ) )
{
define( 'IPS_DEFAULT_PUBLIC_APP', 'forums' );
}

 

 

на это:

 

/**
* Default app name
* You can set this in your own scripts before 'initdata.php' is required.
*/
if ( ! defined( 'IPS_DEFAULT_PUBLIC_APP' ) )
{
define( 'IPS_DEFAULT_PUBLIC_APP', 'ccs' );
}

 

 

3. Сбрасываем кэш ЧПУ (одноименная кнопка в админке)

 

4. Делаем первой вкладкой в меню наш сайт на IP.Content (опционально)

 

В шаблоне Global Templates > globalTemplate находим:

 

						<if test="showhomeurl:|:$this->settings['home_url'] AND $this->settings['home_name']">
						<li id='nav_home' class='left'><a href='{$this->settings['home_url']}' title='{$this->lang->words['homepage_title']}' rel="home">{$this->settings['home_name']}</a></li>
					</if>

 

 

Заменяем на:

 

						{parse variable="ccsActive" default="" oncondition="IPS_APP_COMPONENT == 'ccs'" value="active"}
					<li id='nav_ccs' class='left {parse variable="ccsActive"}'><a href='{$this->settings['home_url']}' title='{$this->lang->words['homepage_title']}' rel="home">{$this->settings['home_name']}</a></li>

 

 

Адрес и текст этой ссылки задаются в настройках, в группе "General Configuration", поля Website name и Website address. В принципе, если скинов не много, можно сразу написать:

 

						{parse variable="ccsActive" default="" oncondition="IPS_APP_COMPONENT == 'ccs'" value="active"}
					<li id='nav_ccs' class='left {parse variable="ccsActive"}'><a href='/' title='На главную' rel="home">Сайт</a></li>

 

 

В настройках IP.Content выставляем "Show 'Pages' navigation bar entry" на "No".

 

Результат

 

Теперь у вас все несуществующие адреса будут передаваться в IP.Content, который будет либо выдавать текстовую ошибку 404, либо показывать с тем же 404-заголовком любую назначенную вами страницу IP.Content. Главная страница IP.Content (по-умолчанию - index.html, меняется в настройках) станет главной страницей всего форума. Список форумов уйдет на подпапку "/forums/", все остальные приложения останутся в своих подпапках.

 

Итоговая структура:

/ - IP.Content
/forums/ - Форум
/blogs/ - Блоги
/gallery/ - Галерея
и т.д.

 

Примечание! Если вам нужно только назначить IP.Content как приложение по умолчанию, достаточно выполнить только второй пункт.

Статья рассказывает о именно том, как создать эффект "корневого" приложения, когда форум визуально находится в виртуальную папку /forums/

 

Это сообщение было вынесено в статью

Рекомендованные сообщения

Опубликовано:

Приветствую, всех собравшихся!

 

Такой вопрос:

Если мы "поднимем" форум в виртуальную папку "forums", то не будет ли потом путь к нашим категориям на форуме иметь вид http://site.ru/forums/forum/ ?

Опубликовано:

Спасибо, Атаман.

 

Есть идея (не моя), поднять форум в папку "community", тогда путь к категориям будет иметь вид: http://site.ru/community/forum/

Как вам такая идея?

 

Ещё вопросы по теме:

Если мы изменим файл furlTemplates.php, то как потом производить обновление или это не помеха?

И вообще, как отразится изменение файла furlTemplates.php на работе форума в целом и на СЕО в частности?

 

Поделитесь пожалуйста опытом :)

Опубликовано:
Как вам такая идея?

Нам вообще без разницы.

 

А что мешает уже поставить форум в корень, раз там все равно ип.контент за главной?

Опубликовано:

siv1987, я имел в виду поднять форум в виртуальную папку, как описывается в данной теме, только поменять название этой виртуальной папки на другое.

 

А что с остальными вопросами?

Опубликовано:

я имел в виду поднять форум в виртуальную папку, как описывается в данной теме, только поменять название этой виртуальной папки на другое.

Так а какой смысл тут в виртуальных адресах, объясните нам? Что мешает установить форум прямо в корень без никаких виртуальных папках?

 

Если мы изменим файл furlTemplates.php, то как потом производить обновление или это не помеха?

Как обычно.

 

И вообще, как отразится изменение файла furlTemplates.php на работе форума в целом и на СЕО в частности?

Никак и никак не отразится.

  • 4 недели спустя...
Опубликовано:

Доброго времени суток

 

Перебрал все варианты furlTemplates.php из темы. Ни в какую не хочет переходить последнего сообщения или последней темы.

сайт.ru/forums/topic/4-тема/?view=getlastpost - так выглядит ссылка

сайт.ru/forums/topic/4#тема/ куда она приводит. В итоге главная страница

 

 

<?php
/**
* <pre>
* Invision Power Services
* IP.Board v3.3.4
* Sets up SEO templates
* Last Updated: $Date: 2012-06-12 10:14:49 -0400 (Tue, 12 Jun 2012) $
* </pre>
*
* @author      $Author: bfarber $
* @copyright   (c) 2001 - 2009 Invision Power Services, Inc.
* @license     http://www.invisionpower.com/company/standards.php#license
* @package     IP.Board
* @subpackage  Forums
* @link        http://www.invisionpower.com
* @since       20th February 2002
* @version     $Rev: 10914 $
*
*/

if ( ! defined( 'IN_IPB' ) )
{
   print "<h1>Incorrect access</h1>You cannot access this file directly. If you have recently upgraded, make sure you upgraded all the relevant files.";
   exit();
}

/**
* SEO templates
*
* 'allowRedirect' is a flag to tell IP.Board whether to check the incoming link and if not formatted correctly, redirect the correct one
*
* OUT FORMAT REGEX:
* First array element is a regex to run to see if we've a match for the URL
* The second array element is the template to use the results of the parenthesis capture
*
* Special variable #{__title__} is replaced with the $title data passed to output->formatUrl( $url, $title)
*
* IMPORTANT: Remember that when these regex are used, the output has not been fully parsed so you will get:
* showuser={$data['member_id']} NOT showuser=1 so do not try and match numerics only!
*
* IN FORMAT REGEX
*
* This allows the registry to piece back together a URL based on the template regex
* So, for example: "/user/(\d+?)/", 'matches' => array(  array( 'showuser' => '$1' ) )tells IP.Board to populate 'showuser' with the result
* of the parenthesis capture #1
*/
$_SEOTEMPLATES = array(

   'showannouncement'     => array( 'app'           => 'forums',
                                    'allowRedirect' => 1,
                                    'out'           => array( '#showannouncement=(.+?)((?:&|&)f=(.+?))?(&|$)#i', 'forums/forum-$3/announcement-$1-#{__title__}/$4' ),
                                    'in'            => array( 'regex'   => '#/forums/forum-(\d+?)?/announcement-(\d+?)-#i',
                                                              'matches' => array( array( 'showannouncement', '$2' ), array( 'f', '$1' ) ) ) ),

   'showforum'     => array( 'app'           => 'forums',
                             'allowRedirect' => 1,
                             'out'           => array( '#showforum=(.+?)(&|$)#i', 'forums/forum/$1-#{__title__}/$2' ),
                             'in'            => array( 'regex'   => '#^/forums/forum/(\d+?)-#i',
                                                       'matches' => array( array( 'showforum', '$1' ) ) ) ),

   'showtopicunread'=> array( 'app'              => 'forums',
                              'allowRedirect'    => 1,
                              'out'              => array( '#showtopic=(.+?)(?:&|&)view=getnewpost(&|$)#i', 'forums/topic/$1-#{__title__}/unread/$2' ),
                              'in'               => array( 'regex'   => '#^/forums/topic/(\d+?)-([^/]+?)/unread(/|$)#i',
                                                           'matches' => array( array( 'showtopic', '$1' ),
                                                                               array( 'view', 'getnewpost' ) ) ) ),

   'showtopicnextunread'=> array( 'app'              => 'forums',
                                  'allowRedirect'    => 1,
                                  'out'              => array( '#showtopic=(.+?)(?:&|&)view=getnextunread(&|$)#i', 'forums/topic/$1-#{__title__}/nextunread/$2' ),
                                  'in'               => array( 'regex'   => '#^/forums/topic/(\d+?)-([^/]+?)/nextunread(/|$)#i',
                                                               'matches' => array( array( 'showtopic', '$1' ),
                                                                                   array( 'view', 'getnextunread' ) ) ) ),

   'showtopic'     => array( 'app'           => 'forums',
                             'allowRedirect' => 1,
                             'out'           => array( '#showtopic=(.+?)(&|$)#i', 'forums/topic/$1-#{__title__}/$2' ),
                             'in'            => array( 'regex'   => '#^/forums/topic/(\d+?)-#i',
                                                       'matches' => array( array( 'showtopic', '$1' ) ) ) ),

   'acteqst'       => array( 'app'           => 'forums',
                             'allowRedirect' => 1,
                             'out'           => array( '#act=ST(.*?)&t=(.+?)(&|$)#i', 'forums/topic/$2-#{__title__}/$3' ),
                             'in'            => array( 'regex'   => '#^notavalidrequest$#i',
                                                       'matches' => array( array( 'showtopic', '0' ) ) ) ),

   'act=idx'       => array( 'app'           => 'forums',
                             'allowRedirect' => 0,
                             'out'           => array( '#act=idx(&|$)#i', 'forums/$1' ),
                             'in'            => array( 'regex'   => '#^/forums(/|$|\?)#i',
                                                       'matches' => array( array( 'act', 'idx' ) ) ) ),
);

 

Опубликовано:

Вам помочь сложно. Вы правите шаблон furl для IP.Content, а ссылки показываете форумные, IP.Board то есть... Темой часом не ошиблись?

Опубликовано:

Вообще, шаблоны чпу трогать не нужно, либо их тупо копировать с ранних версий. В 3.4 (который указан у вас в профиле) есть еще элемент 'isPagesMode', которого нету в вашем чпу файле от 3.3

 

Открыть /admin/applications/forums/extensions/furlTemplates.php, найти showtopic=(.+?)(&|$) и заменить на showtopic=(.+?)(\#|&|$)

После, обновить кеш чпу в админцентре. А по хорошему восстановить этот файл из дистрибутива, обновить кеш чпу, а все изменения в нем делать вручную.

  • 1 месяц спустя...
Опубликовано:

Стоит ли поднимать форум в forum? Как на это реагируют поисковые машины?

  • 5 месяцев спустя...
Опубликовано:

Опять заноза... Все вроде бы работает, правильные урл на страницы и все вроде бы ничего. Но вот при просмотре какой либо категории(не страницы) , новости. У урл есть какой та пробел

post-50062-0-76120300-1413873306_thumb.png

Как только я не пытался править код. Ну никак не пойму... В скрипте(категории),убрал все вроде ок. Урл теперь верный но, не находит контент(мол страница не найдена).

Выручайте, всю голову "сломал"...

 

122-категория, что за пробел перед ней?

Опубликовано:

Спс, что та прояснилось. Так, вот поменять название все ок. А как насовсем удалить? Второй час сижу, ничего не получается, не понимаю одного.

$_reconstructed = $this->returnUrlProtocol().$_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI'];

Откуда в переменной $_SERVER['REQUEST_URI'], берется DATABASE_FURL_MARKER. Как 'DATABASE_FURL_MARKER' попала туда+категория...

Опубликовано:
А как насовсем удалить?
Я заменила только в index.php на "ipb", потому что совсем убрать нельзя.

 

Откуда в переменной $_SERVER['REQUEST_URI'], берется DATABASE_FURL_MARKER.

Там, откуда перед этим этот $_SERVER['REQUEST_URI'] был сгенерирован.

Создайте аккаунт или войдите в него для комментирования

Сейчас на странице 0

  • Нет пользователей, просматривающих эту страницу.

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.