Skocz do zawartości
"Idzie nowe..." - o zmianach i nie tylko ×
Przeniesienie zakupów z IPS Marketplace / Moving bought items from IPS Marketplace ×

Sidebar on the topics and forum views


Pavulon

Rekomendowane odpowiedzi

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

  • Lubię to 4
Odnośnik do komentarza
Udostępnij na innych stronach

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.

Odnośnik do komentarza
Udostępnij na innych stronach

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 !

Odnośnik do komentarza
Udostępnij na innych stronach

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

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

Jedynie zarejestrowani użytkownicy mogą komentować zawartość tej strony.

Zarejestruj nowe konto

Załóż nowe konto. To bardzo proste!

Zarejestruj się

Zaloguj się

Posiadasz już konto? Zaloguj się poniżej.

Zaloguj się
  • Ostatnio przeglądający   0 użytkowników

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

Powiadomienie o plikach cookie

Umieściliśmy na Twoim urządzeniu pliki cookie, aby pomóc Ci usprawnić przeglądanie strony. Możesz dostosować ustawienia plików cookie, w przeciwnym wypadku zakładamy, że wyrażasz na to zgodę.