Skip to content
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.

Блок блогов на главной

Очень понравилась реализация вывода блока блогов на главной. Хотелось бы себе сделать так же.. Но для меня такая задача не посильна. Может кто-то видел такой хук? Хотелось бы себе так сделать. Версия форума IPB 3.1.4

 

6f51fc37ef5et.jpg

Featured Replies

Это стандартный хук блога, по умолчанию он выключен, его нужно включить. Чтобы получить такой вид, нужно его модифицировать не много.

У меня получилось так:

 

04-07-2011 12-09-50.png

  • Author

Ну стандартный хук включается справа от форума. Другой хук с блогом включает "особые записи" из блогов. А вот что бы вот так, такого хука нет =(

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

Хук называется Recent Blog Entries, он отображается в правом сайдбаре, например как на этом форуме и его нужно модифицировать.

  • Author

а какие изменения делали вы? :rolleyes:

Засунул всё это дело в хук:

hook.xml

 

Установка:

1) Удалить старый Recent Blog Entries

2) Импортировать новый

3) Сделать изменения в файле admin/applications_addon/ips/blog/sources/classes/hooks/gateway.php

 

Найти:

 

			$this->DB->build( array('select'   => 'e.entry_id, e.entry_last_update, e.entry_name, e.blog_id, e.entry_name_seo, e.entry_author_id, e.entry_date',
									'from'     => array('blog_entries' => 'e' ),
									'where'    => $_where,
									'order'    => 'e.entry_date DESC',
									'limit'    => array( 0, 5 ),
									'add_join' => array( array( 'select' => 'b.blog_name, b.blog_seo_name',
																'from'   => array( 'blog_blogs' => 'b' ),
																'where'  => 'b.blog_id=e.blog_id',
																'type'   => 'left' ) ) ) );

 

Заменить на:

 

				$this->DB->build( array('select'   => 'e.entry_id, e.entry_last_update, e.entry_name, e.blog_id, e.entry_name_seo, e.entry_author_id, e.entry_date',
									'from'     => array('blog_entries' => 'e' ),
									'where'    => $_where,
									'order'    => 'e.entry_date DESC',
									'limit'    => array( 0, 12 ),
									'add_join' => array( array( 'select' => 'b.blog_name, b.blog_seo_name',
																'from'   => array( 'blog_blogs' => 'b' ),
																'where'  => 'b.blog_id=e.blog_id',
																'type'   => 'left' ) ) ) );

 

По хорошему бы, перенести функцию из gateway.php в файл хука, но опыта пока не достаточно.

  • Author

немного путь до файла неверный

вот правильный admin/applications_addon/ips/blog/sources/classes/hooks/gateway.php

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

Получается у меня в один столбец все 12 записей из блогов.

Edited by mylipetsk

Пардон, в файле gateway.php указан другой шаблон, не hookRecentBlogEntries, а recentEntries. По этому нужно заменить.

 

Ваш шаблон > Шаблоны > blog_portal ((Блог) Дополнение портала) > recentEntries

 

Весь шаблон:

 

<div class='general_box clearfix'>
{parse striping="recententries" classes="row1,row2"}
<h3><img src='{$this->settings['img_url']}/comment_new.png' alt='' /> <if test="isset($this->lang->words['recently_added_entries'])">{$this->lang->words['recently_added_entries']}<else />{$this->lang->words['latest_entries_title']}</if></h3>
<ul class='hfeed block_list'  style='padding:0px'>
	<if test="is_array( $entries )">
		<foreach loop="$entries as $eid => $entry">
			<li class='{parse striping="recententries"}' style='clear:both'>
				<img src='{$entry['pp_mini_photo']}' width='{$entry['pp_mini_width']}' height='{$entry['pp_mini_height']}' alt='' class='photo' style='float:left' />
				<div class='nexttophoto' style='padding:2px 6px 2px 6px; margin-left: 40px;'>
					<if test="newcomment:|:$entry['newpost']">
					 <a href="{parse url="app=blog&module=display&section=blog&blogid={$entry['blog_id']}&showentry={$entry['entry_id']}&show=newcomment" template="showentry" seotitle="{$entry['entry_name_seo']}" base="public"}">{parse replacement="f_newpost"}</a> 
					</if>
					<a href="{parse url="app=blog&module=display&section=blog&blogid={$entry['blog_id']}&showentry={$entry['entry_id']}" template="showentry" seotitle="{$entry['entry_name_seo']}" base="public"}">{$entry['entry_name']}</a>
					<p class='desc'><a href='{parse url="app=blog&module=display&section=blog&blogid={$entry['blog_id']}" template="showblog" seotitle="{$entry['blog_seo_name']}" base="public"}'><strong>{$entry['blog_name']}</strong></a> {parse date="$entry['entry_date']" format="short"}</p>
				</div>
			</li>
		</foreach>
	</if>
</ul>
</div>

 

Заменить на:

 

<h3 class='maintitle'><img src='{$this->settings['img_url']}/comment_new.png' alt='' /> <if test="isset($this->lang->words['recently_added_entries'])">{$this->lang->words['recently_added_entries']}<else />{$this->lang->words['latest_entries_title']}</if></h3>
<div class='general_box clearfix'>
	<if test="is_array( $entries )">
		<foreach loop="$entries as $eid => $entry">
			<div class='' style='display: block; float: left; width: 23%; margin: 5px;'>
				<img src='{$entry['pp_mini_photo']}' width='{$entry['pp_mini_width']}' height='{$entry['pp_mini_height']}' alt='' class='photo' style='float:left' />
				<div class='nexttophoto' style='padding:2px 6px 2px 6px; margin-left: 40px;'>
					<if test="newcomment:|:$entry['newpost']">
					 <a href="{parse url="app=blog&module=display&section=blog&blogid={$entry['blog_id']}&showentry={$entry['entry_id']}&show=newcomment" template="showentry" seotitle="{$entry['entry_name_seo']}" base="public"}">{parse replacement="f_newpost"}</a> 
					</if>
					<a href="{parse url="app=blog&module=display&section=blog&blogid={$entry['blog_id']}&showentry={$entry['entry_id']}" template="showentry" seotitle="{$entry['entry_name_seo']}" base="public"}">{$entry['entry_name']}</a>
					<p class='desc'><a href='{parse url="app=blog&module=display&section=blog&blogid={$entry['blog_id']}" template="showblog" seotitle="{$entry['blog_seo_name']}" base="public"}'><strong>{$entry['blog_name']}</strong></a> {parse date="$entry['entry_date']" format="short"}</p>
				</div>
			</div>
		</foreach>
	</if>
</div>

 

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

  • Author

Да вроде у вас нормально получается создавать хуки. Спросить еще вопросик, а как бы мне сделать горизонтальные полосочки разделяющие записи из блогов. ну как на картинке.

Тут бы по-хорошему с помощью таблицы сделать, но я не знаю как сделать чтобы на одном уровне только 4 ячейки, а 5 переносилась на второй уровень.

 

{parse striping="recententries" classes="row1,row2"}
<h3 class='maintitle'><img src='{$this->settings['img_url']}/comment_new.png' alt='' /> <if test="isset($this->lang->words['recently_added_entries'])">{$this->lang->words['recently_added_entries']}<else />{$this->lang->words['latest_entries_title']}</if></h3>
<table summary="" class='ipb_table'>
<tbody>
<tr>
               <if test="is_array( $entries )">
                       <foreach loop="$entries as $eid => $entry">
                               <td class="{parse striping="recententries"}" style="width: 25%;">
                                       <img src='{$entry['pp_mini_photo']}' width='{$entry['pp_mini_width']}' height='{$entry['pp_mini_height']}' alt='' class='photo' style='float:left' />
                                       <div class='nexttophoto' style='padding:2px 6px 2px 6px; margin-left: 40px;'>
                                               <if test="newcomment:|:$entry['newpost']">
                                                <a href="{parse url="app=blog&module=display&section=blog&blogid={$entry['blog_id']}&showentry={$entry['entry_id']}&show=newcomment" template="showentry" seotitle="{$entry['entry_name_seo']}" base="public"}">{parse replacement="f_newpost"}</a> 
                                               </if>
                                               <a href="{parse url="app=blog&module=display&section=blog&blogid={$entry['blog_id']}&showentry={$entry['entry_id']}" template="showentry" seotitle="{$entry['entry_name_seo']}" base="public"}">{$entry['entry_name']}</a>
                                               <p class='desc'><a href='{parse url="app=blog&module=display&section=blog&blogid={$entry['blog_id']}" template="showblog" seotitle="{$entry['blog_seo_name']}" base="public"}'><strong>{$entry['blog_name']}</strong></a> {parse date="$entry['entry_date']" format="short"}</p>
                                       </div>
                               </td>
                       </foreach>
               </if>
</tr>
</tbody>
</table>

  • Author

ну а может жестко сделать, 4 ячейки ине более и не менее. И тогда можно будет провести горизонтальные полоски, да?

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

Create an account or sign in to comment

Recently Browsing 0

  • No registered users viewing this page.

Account

Navigation

Search

Search

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.