Skocz do zawartości
Hosting webh.pl - 20%

Sidebar on the topics and forum views

Rekomendowane odpowiedzi

Opublikowano

With this modification we obtain sidebar on the topics, forum and Category view available as standard only on the board index.

Open:

admin/sources/classes/skins/skinCaching.php

Find:

				$out = $this->stripUnneededHooks( $out, $allHooks[ $group['template_group'] ] );

Chagne to:

				if ($group['template_group'] == 'skin_forum' || $group['template_group'] == 'skin_topic')
			{
				$hooks_tostrip = array();

				if (is_array( $allHooks['skin_boards'] ) and count( $allHooks['skin_boards'] ))
					foreach ($allHooks['skin_boards'] as $shook)
						$hooks_tostrip[] = $shook;

				if (is_array( $allHooks[ $group['template_group'] ] ) and count( $allHooks[ $group['template_group'] ] ))
					foreach ($allHooks[ $group['template_group'] ] as $shook)
						$hooks_tostrip[] = $shook;

				$out = $this->stripUnneededHooks( $out, $hooks_tostrip );
			} else
				$out = $this->stripUnneededHooks( $out, $allHooks[ $group['template_group'] ] );

Find:

				if ( $hook['_commentTag'] )
			{
				$html = str_replace( '<!--hook.' . $hook['_commentTag'] . '-->', '{!--hook.' . $hook['_commentTag'] . '--}', $html );
			}

Change to:

				if ( $hook['_commentTag'] )
			{
				$html = str_replace( '<!--hook.' . $hook['_commentTag'] . '-->', '{!--hook.' . $hook['_commentTag'] . '--}', $html );
				$newcommentTag = str_replace( 'skin_boards.boardIndexTemplate.side_blocks', 'skin_forum.forumIndexTemplate.side_blocks', $hook['_commentTag']);
				$html = str_replace( '<!--hook.' . $newcommentTag . '-->', '{!--hook.' . $newcommentTag . '--}', $html );
				$newcommentTag = str_replace( 'skin_boards.boardIndexTemplate.side_blocks', 'skin_topic.topicViewTemplate.side_blocks', $hook['_commentTag']);
				$html = str_replace( '<!--hook.' . $newcommentTag . '-->', '{!--hook.' . $newcommentTag . '--}', $html );
			}

Find:

				if ( $hook['_commentTag'] )
			{
				$html = str_replace( '{!--hook.' . $hook['_commentTag'] . '--}', '<!--hook.' . $hook['_commentTag'] . '-->', $html );
			}

Change to:

				if ( $hook['_commentTag'] )
			{
				$html = str_replace( '{!--hook.' . $hook['_commentTag'] . '--}', '<!--hook.' . $hook['_commentTag'] . '-->', $html );
				$newcommentTag = str_replace( 'skin_boards.boardIndexTemplate.side_blocks', 'skin_forum.forumIndexTemplate.side_blocks', $hook['_commentTag']);
				$html = str_replace( '{!--hook.' . $newcommentTag . '--}', '<!--hook.' . $newcommentTag . '-->', $html );
				$newcommentTag = str_replace( 'skin_boards.boardIndexTemplate.side_blocks', 'skin_topic.topicViewTemplate.side_blocks', $hook['_commentTag']);
				$html = str_replace( '{!--hook.' . $newcommentTag . '--}', '<!--hook.' . $newcommentTag . '-->', $html );
			}

Open:

admin/sources/classes/output/publicOutput.php

Find:

					if( ! in_array( $tplHook['skinGroup'], $skin_groups ) )
				{
					continue;
				}

Change to:

					if( ! in_array( $tplHook['skinGroup'], $skin_groups ) &&
						! ( $tplHook['skinGroup']=='skin_boards' &&
						( in_array( 'skin_forum', $skin_groups ) || in_array( 'skin_topic', $skin_groups ))))
				{
					continue;
				}

Find:

		if( count( $hook_output ) )
	{
		foreach( $hook_output as $hook_location => $hook_content )
		{
			$text = str_replace( '<!--hook.' . $hook_location . '-->', '<!--hook.' . $hook_location . '-->' . $this->replaceMacros( $hook_content ), $text );
		}
	}

Change to:

		if( count( $hook_output ) )
	{
		foreach( $hook_output as $hook_location => $hook_content )
		{
			$text = str_replace( '<!--hook.' . $hook_location . '-->', '<!--hook.' . $hook_location . '-->' . $this->replaceMacros( $hook_content ), $text );

			if (in_array( 'skin_forum', $skin_groups ) && $hook_location == 'foreach.skin_boards.boardIndexTemplate.side_blocks.outer.pre')
			{
				$text = str_replace( '<!--hook.foreach.skin_forum.forumIndexTemplate.side_blocks.outer.pre-->', '<!--hook.foreach.skin_forum.forumIndexTemplate.side_blocks.outer.pre-->' . $this->replaceMacros( $hook_content ), $text );
			}

			if (in_array( 'skin_topic', $skin_groups ) && $hook_location == 'foreach.skin_boards.boardIndexTemplate.side_blocks.outer.pre')
			{
				$text = str_replace( '<!--hook.foreach.skin_topic.topicViewTemplate.side_blocks.outer.pre-->', '<!--hook.foreach.skin_topic.topicViewTemplate.side_blocks.outer.pre-->' . $this->replaceMacros( $hook_content ), $text );
			}
		}
	}

Open:

public/js/ips.board.js

Find:

			ipb.board.setUpForumTables();
		ipb.board.initSidebar();

Change to:

			ipb.board.initSidebar();
		ipb.board.setUpForumTables();

Open:

public/js/ips.topic.js

Find:

	/* ------------------------------ */
/**
 * Shows a prompt allowing user to copy the URL
 *
 * @var		{event}		e		The event
*/
showLinkToTopic: function(e, elem)
{	
	_t = prompt( ipb.lang['copy_topic_link'], $( elem ).readAttribute('href') );
	Event.stop(e);
},

Change to:

	/* ------------------------------ */
/**
 * Shows a prompt allowing user to copy the URL
 *
 * @var		{event}		e		The event
*/
showLinkToTopic: function(e, elem)
{
	var parent=$(elem);var ret=true;while(parent=parent.parentNode){if(parent.id=='index_stats'){ret=false;break;}else if(parent.id=='undefined')break;}
	if (ret)
	{
		_t = prompt( ipb.lang['copy_topic_link'], $( elem ).readAttribute('href') );
		Event.stop(e);
	}
},

Skin edits {Based on CleanCut Skin}

Open:

forumIndexTemplate

Edit Template Variables

At the end add:

, $show_side_blocks=true, $side_blocks=array()

Find:

{parse js_module="forums"}

Add below:

{parse js_module="board"}
{parse js_module="hooks"}
{parse variable="sidebar_enabled" default="$show_side_blocks"}

Find:

<if test="rulesinline:|:$forum_data['show_rules'] == 2">

Add above:

<if test="sideBarEnabled:|:$this->templateVars['sidebar_enabled']">
<a href='{parse url="app=forums&module=extras&section=toggle" base="public"}' id='close_sidebar'  class='sidebar_toggle' <if test="sidebaropen:|:IPSCookie::get('hide_sidebar') != '1'">style='display: none'</if>><img src='{$this->settings['img_url']}/sidebar_close.png' alt='{$this->lang->words['sidebar_close']}' /></a>
<a href='{parse url="app=forums&module=extras&section=toggle" base="public"}' id='open_sidebar' class='sidebar_toggle' <if test="sidebarclosed:|:IPSCookie::get('hide_sidebar') == '1'">style='display: none'</if>><img src='{$this->settings['img_url']}/sidebar_open.png' alt='{$this->lang->words['sidebar_open']}' /></a>
</if>

Find:

<!-- __-SUBFORUMS-__ -->
<if test="hassubforums:|:is_array( $sub_forum_data ) AND count( $sub_forum_data )">

dodaj powyżej:

<div id='forum_index' class='clearfix'>
<if test="sideBarEnabled2:|:$this->templateVars['sidebar_enabled']">
	<div id='index_stats' class='right clearfix' <if test="sidebarclosed2:|:IPSCookie::get('hide_sidebar') == '1'">style='display: none'</if>>
		<foreach loop="side_blocks:$side_blocks as $block">
			{$block}
		</foreach>
	</div>
</if>


<div id='categories' class='<if test="nosidebar:|:IPSCookie::get('hide_sidebar') == '1' || !$this->templateVars['sidebar_enabled']">no_sidebar</if> clearfix'>

At the end add:

</div>
</div>

Open:

topicViewTemplate

Edit Template Variables

At the end add:

, $show_side_blocks=true, $side_blocks=array()

Find:

{parse js_module="topic"}

Add below:

{parse js_module="board"}
{parse js_module="hooks"}
{parse variable="sidebar_enabled" default="$show_side_blocks"}

Find:

<if test="disablelightbox:|:!$this->settings['disable_lightbox']">

Add above:

<if test="sideBarEnabled:|:$this->templateVars['sidebar_enabled']">
<a href='{parse url="app=forums&module=extras&section=toggle" base="public"}' id='close_sidebar'  class='sidebar_toggle' <if test="sidebaropen:|:IPSCookie::get('hide_sidebar') != '1'">style='display: none'</if>><img src='{$this->settings['img_url']}/sidebar_close.png' alt='{$this->lang->words['sidebar_close']}' /></a>
<a href='{parse url="app=forums&module=extras&section=toggle" base="public"}' id='open_sidebar' class='sidebar_toggle' <if test="sidebarclosed:|:IPSCookie::get('hide_sidebar') == '1'">style='display: none'</if>><img src='{$this->settings['img_url']}/sidebar_open.png' alt='{$this->lang->words['sidebar_open']}' /></a>
</if>

Find:

<if test="isNotThreadedMode:|:$displayData['threaded_mode_enabled'] == 0">

Add above:

<div id='topic_index' class='clearfix'>
<if test="sideBarEnabled2:|:$this->templateVars['sidebar_enabled']">
	<div id='index_stats' class='right clearfix' <if test="sidebarclosed2:|:IPSCookie::get('hide_sidebar') == '1'">style='display: none'</if>>
		<foreach loop="side_blocks:$side_blocks as $block">
			{$block}
		</foreach>
	</div>
</if>


<div id='categories' class='<if test="nosidebar:|:IPSCookie::get('hide_sidebar') == '1' || !$this->templateVars['sidebar_enabled']">no_sidebar</if> clearfix'>

At the end add:

</div>
</div>

Screenshots:

Board Index: post-1579-093060200 1275125770_thumb.jpg

Category: post-1579-041810100 1275125807_thumb.jpg

Forum: post-1579-076292400 1275125852_thumb.jpg

Topic: post-1579-020415300 1275125924_thumb.jpg

Opublikowano

I do not think that it works in 3.10. Found this problem in beta 3:

Open:

admin/sources/classes/output/publicOutput.php

Find:

                                        if( ! in_array( $tplHook['skinGroup'], $skin_groups ) )
                                       {
                                               continue;
                                       }

That piece of code doesn't exist.

Opublikowano

Any chance that you could upgrade the tutorial to 3.1?

Opublikowano
  • Autor

Ok. Who want to try a new method ?

Everything is like before except publicOutput.php part.

Open:

admin/sources/classes/output/publicOutput.php

Find:

    	foreach( $this->compiled_templates as $group => $tpl )
   	{
   		$skin_groups[] = $group;
   	}

Add below:

			if (in_array('skin_forum',$skin_groups))
			$skingroup = 'skin_forum.forumIndexTemplate';
		else if (in_array('skin_topic',$skin_groups))
			$skingroup = 'skin_topic.topicViewTemplate';

		if (isset($skingroup)) $skin_groups[] = 'skin_boards';

Find:

					$arr_key = $tplHook['type'] . '.' . $tplHook['skinGroup'] . '.' . $tplHook['skinFunction'] . '.' . $tplHook['id'] . '.' . $tplHook['position'];

Add below:

					if ($tplHook['skinFunction']=='boardIndexTemplate' && isset($skingroup))
					$arr_key = str_replace( 'skin_boards.boardIndexTemplate.side_blocks', $skingroup.'.side_blocks', $arr_key);

Save and close !

Opublikowano

I do not think that it works. Just tried it on my 3.10 test board and sidebar doesn't show anywhere and no space gets reserved for it in forum or topic view.

  • 4 miesiące temu...
  • 8 miesięcy temu...
Opublikowano

Well, is usefull, but is a lot os things need to edit, anyway, thank you.

Jeśli chcesz dodać odpowiedź, zaloguj się lub zarejestruj nowe konto

Ostatnio przeglądający 0

  • Brak zarejestrowanych użytkowników przeglądających tę stronę.

Konto

Nawigacja

Szukaj

Szukaj

Skonfiguruj powiadomienia push w przeglądarce

Chrome (Android)
  1. Stuknij ikonę kłódki obok paska adresu.
  2. Stuknij Uprawnienia → Powiadomienia.
  3. Dostosuj swoje ustawienie.
Chrome (Komputer)
  1. Kliknij ikonę kłódki na pasku adresu.
  2. Wybierz Ustawienia witryny.
  3. Znajdź Powiadomienia i dostosuj swoje ustawienie.