Jump to content
View in the app

A better way to browse. Learn more.

IPBMafia.ru - поддержка 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.

Статьи и автоматическая публикация на форуме

Featured Replies

Posted

В линейки 3.Х  была возможность использовать форум для комментариев статей. В 4.Х это то же есть, но в отличии от 3-шки, здесь нет возможности настроить публикацию темы на форуме. 

Создается тема с полным дублем статьи. Нафига? Можно же Некое интро только публиковать, или первые скажем 250 знаков. 

Например, я создал поле Intro туда я пишу анонс статьи. Использую для отображение на сайте. Можно было-бы только это поле публиковать, а не весь контент. 

Может кто разбирается во внутренней кухне движка и подскажет как подправить код? 

Есть файл Records.php, он находится по адресу /applications/cms/sources/Records/Records.php

Там, со строки 1952 начинается код отвечающий за публикацию на форуме. 

Може, кто подкажет че поменять? Я не знаком с переменными и прочей кухней движка. 

ЗЫ. Вот кусок кода. 

/**
	 * Post this record as a forum topic
	 * 
	 * @return void
	 */
	public function syncTopic()
	{
		if ( ! \IPS\Application::appIsEnabled( 'forums' ) )
		{
			throw new \UnexpectedValueException('content_record_no_forum_app_for_topic');
		}

		/* Fetch the forum */
		try
		{
			$forum = \IPS\forums\Forum::load( $this->_forum_forum );
		}
		catch( \OutOfRangeException $ex )
		{
			throw new \UnexpectedValueException('content_record_bad_forum_for_topic');
		}

		/* Existing topic */
		if ( $this->record_topicid )
		{
			/* Get */
			try
			{
				$topic = \IPS\forums\Topic::load( $this->record_topicid );
				if ( !$topic )
				{
					return;
				}
				/* Reset cache */
				$this->displayTitle = NULL;
				$topic->title = $this->_forum_prefix . $this->_title . $this->_forum_suffix;
				if ( \IPS\Settings::i()->tags_enabled )
				{
					$topic->setTags( $this->prefix() ? array_merge( $this->tags(), array( 'prefix' => $this->prefix() ) ) : $this->tags() );
				}
				
				if ( $this->hidden() )
				{
					$topic->hide( FALSE );
				}
				else if ( $topic->hidden() )
				{
					$topic->unhide( FALSE );
				}

				$topic->save();
				$firstPost = $topic->comments( 1 );

				$content = \IPS\Theme::i()->getTemplate( 'submit', 'cms', 'front' )->topic( $this );
				\IPS\Member::loggedIn()->language()->parseOutputForDisplay( $content );

				$firstPost->post = $content;
				$firstPost->save();
			}
			catch ( \OutOfRangeException $e )
			{
				return;
			}
		}
		/* New topic */
		else
		{
			/* Create topic */
			$topic = \IPS\forums\Topic::createItem( $this->author(), \IPS\Request::i()->ipAddress(), \IPS\DateTime::ts( $this->record_publish_date ? $this->record_publish_date : $this->record_saved ), \IPS\forums\Forum::load( $this->_forum_forum ), $this->hidden() );
			$topic->title = $this->_forum_prefix . $this->_title . $this->_forum_suffix;
			$topic->topic_archive_status = \IPS\forums\Topic::ARCHIVE_EXCLUDE;
			$topic->save();

			if ( \IPS\Settings::i()->tags_enabled )
			{
				$topic->setTags( $this->prefix() ? array_merge( $this->tags(), array( 'prefix' => $this->prefix() ) ) : $this->tags() );
			}

			/* Create post */
			$content = \IPS\Theme::i()->getTemplate( 'submit', 'cms', 'front' )->topic( $this );
			\IPS\Member::loggedIn()->language()->parseOutputForDisplay( $content );

			$post = \IPS\forums\Topic\Post::create( $topic, $content, TRUE, NULL, NULL, $this->author(), \IPS\DateTime::ts( $this->record_publish_date ? $this->record_publish_date : $this->record_saved ) );
			$post->save();

			$topic->topic_firstpost = $post->pid;
			$topic->save();

			$topic->markRead();

			/* Update file */
			$this->record_topicid = $topic->tid;
			$this->save();
		}
	}

 

  • Author
14 минут назад, rustav сказал:

да, вопрос интересный. Хотелось бы что-то подобное. Искал на оф. форуме, что-то костыли одни пока

А какого рода костыли?

4 часа назад, Роман Бакай сказал:

Например, я создал поле Intro туда я пишу анонс статьи. Использую для отображение на сайте. Можно было-бы только это поле публиковать, а не весь контент. 

Ну так создавай intro (anonce, teaser или как там назовете) и публикуй только его, в чем проблема? Есть же в настройках полей Topic Format

56d0306125b08_01.thumb.jpg.f91e3a2c73411

  • Author

@kgb У меня при создании или редактировании поля в приложении Pages нет никакого Topic Format. 

И что дает это Топик Формат? Хотя, если бы он был, может быть я и понял. 

Разобрался, оказывается надо в настройках базы данных указать категорию форума, которую надо использовать. Я же это не указывал, только в категориях статей(для каждой отдельно) указывал свою категорию на форуме. При таком раскладе нет Топик Формат. 

 

44 минут назад, Роман Бакай сказал:

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

Ну сделали разработчики так, зачем, не знаю.

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.

Guest
Ответить в этой теме...

Последние посетители 0

  • No registered users viewing this page.

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.