Jump to content

Topic View Sidebar


Donkerrood

Recommended Posts

%7Boption%7D



File Name: Topic View Sidebar

File Submitter: Donkerrood

File Submitted: 14 Jul 2011

File Category: Other style options



This hook shows a sidebar in the topic view, similar to the sidebar on the board index. As with the sidebar on the board index, you can add content blocks to the sidebar by installing hooks at the hook point pre.if.scrollToPost. Further instructions are in the readme.txt.

The download contains two example hooks that you could install to show the sidebar adcode (as shown on the board index) and to show the 10 latest replies.



here to download this file

Link to comment
Share on other sites

I will add a screenshot tonight. Like the title says, the hook creates a sidebar in the topic view. After installing this hook, you can add any content to the sidebar by installing another hook (e.g. the recent topics hook or the ads hook). In this way the hook creates maximum flexibility, because you use IPB's drag and drop hook system to arrange the content blocks.

Link to comment
Share on other sites

I added a screenshot and two example hooks in the updated version. This hook does not require any file edits. Any content can be added by installing an extra hook that returns the content you want. I think this will be clear once you have installed my example hooks from the updated zip file.

Link to comment
Share on other sites

  • 1 month later...
  • 1 month later...
  • 1 month later...
  • 2 months later...

I get this error: Fatal error: Call to undefined method skin_topic_5::recentPosts() in /home/allfreel/public_html/hooks/topicViewRecentPosts_be4751e04f432a7dfd59abb023cb16b0.php on line 79

What happens when I disable topicviewsidebarrecentpost - the sidebar appears as blank.
When I have both recent posts and sidebar ad code enabled, i get this error message listed above.

Links for images below. (sorry, but the images doesn't appear as they should)
http://www.box.com/s/zq3bjah29r8q718i8bje
http://www.box.com/s/uc7lk9hpik2be3rq7zuo

Link to comment
Share on other sites

  • 2 weeks later...

Add a new template to the skin_topic group with the name recentPosts, variables are:


$topics, $title

And the template code is as follows.


<if test="recenttopics:|:is_array( $topics ) && count( $topics )">

<div class='ipsSideBlock clearfix'>

<h3>

<if test="hastitle:|:$title">

{$title}

<else />

<a href="{parse url="app=core&module=search&do=viewNewContent&search_app=forums" base="public"}">{$this->lang->words['recently_added_replies']}</a>

</if>

</h3>

<div class='_sbcollapsable'>

  <ul class='ipsList_withminiphoto'>

  <foreach loop="topics_hook:$topics as $r">

  <li class='clearfix'>

   <a href='{parse url="showuser={$r['member_id']}" seotitle="{$r['members_seo_name']}" template="showuser" base="public"}' title='{$this->lang->words['view_profile']}' class='ipsUserPhotoLink left'>

    <img src='{$r['pp_mini_photo']}' alt="{$r['members_display_name']}{$this->lang->words['users_photo']}" class='ipsUserPhoto ipsUserPhoto_mini' />

   </a>

   <div class='list_content'>

    <a href='{parse url="showtopic={$r['tid']}&amp;view=getnewpost" base="public" template="showtopic" seotitle="{$r['title_seo']}"}' class='ipsType_small' title='{$this->lang->words['view_topic']} {$r['topic_title']}'>{$r['title_display']}</a>

    <p class='desc ipsType_smaller'>

	 <if test="hideuser:|:$r['hideUserName'] == 1"><else />{parse template="userHoverCard" group="global" params="$r"} -</if> {parse date="$r['start_date']" format="short"}

    </p>

   </div>

  </li>

  </foreach>

  </ul>

</div>

</div>

</if>

Link to comment
Share on other sites

  • 1 year later...

This is a great addon

I have also installed (e32) Custom Sidebar Blocks

in order to have custom sidebars in the topic view but I cannot figure out how to get the blocks to show up

It seems the Topic View Sidebar is using different name for the blocks?

Anyone have a solution for how to get Topic View Sidebar to load the (e32) Custom Sidebar Blocks?

Link to comment
Share on other sites

Here is code for hook which will import 20 recent topics, it uses IPB member settings so it respect all forum rules.

Also you do not need to create any additional templates or create any skin template like mentioned previously in this thread.

If you want to change the number of topics shown just edit the number hooks_recentTopics(20)

<?xml version="1.0" encoding="utf-8"?>
<hookexport>
  <hookdata>
    <config>
      <hook_name>Recent Forum Topics</hook_name>
      <hook_desc>Adds a list of recent threads topic view</hook_desc>
      <hook_author/>
      <hook_email/>
      <hook_website/>
      <hook_update_check/>
      <hook_requirements><![CDATA[a:3:{s:21:"required_applications";a:0:{}s:20:"hook_php_version_min";s:0:"";s:20:"hook_php_version_max";s:0:"";}]]></hook_requirements>
      <hook_version_human>1.0.0</hook_version_human>
      <hook_version_long>1000</hook_version_long>
      <hook_extra_data><![CDATA[a:1:{s:7:"display";N;}]]></hook_extra_data>
      <hook_key>viewTopicRecentThreads</hook_key>
      <hook_global_caches/>
    </config>
  </hookdata>
  <hookfiles>
    <file>
      <hook_file_real>boardIndexRecentTopics.php</hook_file_real>
      <hook_type>templateHooks</hook_type>
      <hook_classname>viewTopicRecentThreads</hook_classname>
      <hook_data><![CDATA[a:8:{s:12:"dataLocation";s:0:"";s:14:"libApplication";s:0:"";s:15:"classToOverload";s:0:"";s:9:"skinGroup";s:10:"skin_topic";s:12:"skinFunction";s:17:"topicViewTemplate";s:4:"type";s:2:"if";s:2:"id";s:12:"scrollToPost";s:8:"position";s:11:"pre.startif";}]]></hook_data>
      <hooks_source><![CDATA[<?php

class viewTopicRecentThreads
{
	public $registry;
	
	public function __construct()
	{
		$this->registry = ipsRegistry::instance();
	}
	
	public function getOutput()
	{
		$output = $this->registry->getClass('class_forums')->hooks_recentTopics(20);

		return $output;
	}	
}]]></hooks_source>
    </file>
  </hookfiles>
  <hookextras_settings/>
  <hookextras_language/>
  <hookextras_modules/>
  <hookextras_help/>
  <hookextras_templates/>
  <hookextras_css/>
  <hookextras_replacements/>
  <hookextras_tasks/>
  <hookextras_database_create/>
  <hookextras_database_alter/>
  <hookextras_database_update/>
  <hookextras_database_insert/>
</hookexport>

Using this method you can create any of the sidebar blocks for IP suite.

I have one for recent blog posts too

Link to comment
Share on other sites

  • 1 month later...

Here is code for hook which will import 20 recent topics, it uses IPB member settings so it respect all forum rules.

Also you do not need to create any additional templates or create any skin template like mentioned previously in this thread.

If you want to change the number of topics shown just edit the number hooks_recentTopics(20)

<?xml version="1.0" encoding="utf-8"?>
<hookexport>
  ...
</hookexport>

Using this method you can create any of the sidebar blocks for IP suite.

I have one for recent blog posts too

So save this as an xml file and upload and install on the ACP?

But how will the sidebar be created or show up on the board index?

Do we deactivate the current recent topics sidebar?

Link to comment
Share on other sites

1. So save this as an xml file and upload and install on the ACP?

2. But how will the sidebar be created or show up on the board index?

3. Do we deactivate the current recent topics sidebar?

1. Redownloading the package contains the hook that is in this post you quoted. Import it through ACP and make SURE its BELOW this hook, so it should be like this:

Topic View Sidebar v1.0.0
Shows sidebar in topic view

Topic View Sidebar - Recent Replies v1.0.0
Shows recent replies in Topic View Sidebar

2. It will automatically show up once blocks are added. And it is a TOPIC sidebar, it is not for your board index. Only Global SIdebars can allow you to alter the index sidebar.

3. 2 should answer this question (there is nothing there from start, this is a topic sidebar, you start with no blocks).

Although for me, I still had to add the template bit manually, it doesnt add it in any of these hooks. ( post #13, http://community.invisionpower.com/topic/341477-download-topic-view-sidebar/#entry2231884 )

Also, got the 'cannot modify header info' too:

Warning: Cannot modify header information - headers already sent by (output started at /home/xxxxxx/forums/cache/skin_cache/cacheid_4/skin_topic.php: 972) in /home/xxxxx/forums/admin/sources/classes/output/formats/html/htmlOutput.php on line 141

After recaching template too. I only have that new posts hook installed.

Works great otherwise, thanks!

Link to comment
Share on other sites

  • 2 weeks later...
  • 1 year later...
  • 1 month later...

have you tried adding the recentPosts template manually to the skin group Topic?

Another message regarding this hook; Since IPS4 will support a sidebar on any place in the software you want, this hook will be discontinued. Many thanks to those of you that helped out others on fixing the issues with this hook.

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...