Lack of interest Sidebar everywhere

This suggestion has been closed automatically because it did not receive enough votes over an extended period of time. If you wish to see this, please search for an open suggestion and, if you don't find any, post a new one.

Morgain

Well-known member
I have been successfully adding a sidebar which includes my own content, to lots of the templates.
I've just about achieved a "sidebar everywhere" which is what I wanted.
It involves 25 templates!

This I feel strongly makes my users feel secure. Like the navbar wherever they are they have the same navigation options right there for them. Unlike the navbar it is all right there, not hoidden in tyabs. So my top level navigation is openly there in a reassuring way.
Others may want aother alternative displays in their sidebar.

However the task to make this happen involves adding the code snippet with its include, or for a few the include alone, to around TWENTY FIVE templates!
See here: http://xenforo.com/community/threads/sidebar-everywhere-custom-content.24105/
This is getting a bit silly. I don't mind doing it, and providing the lengthening list for others as well, but it shouldn't be necessary.

Can we please have the sidebar code added to all the templates, default OFF if you like but with a toggle in admincp Options.
A textfield to add the name of a custom template (or two, or several) to be included would also be welcomed. (See my list on the above link for some templates which already have a sidebar as default, so only need the custom content include.)
To be complete a list of all templates relevant with tickboxes to include/ exclude this standard sidebar.
 
Upvote 2
This suggestion has been closed. Votes are no longer accepted.
Well, this become difficult on templates such as you would fine in the User CP, and anything with a form. Forms have a hard-coded width and these areas also sometimes have a left-sidebar. Adding the right sidebar would really mud this up :/

So I do not think the sidebar can be added everywhere. Manually, such as you've done, is probably the best bet although it makes upgrades fun ;)
 
:confused: 25? Where do you get that figure from.

I have a sidebar everywhere with 12 templates customised (excluding css)
 
Well technically you don't need to edit any. Or just one. You can add it to various listeners or just add it to the PAGE_CONTAINER template. Just noticed ragtek posted how in the OP link.
 
No I tried page_container - this left quite a few types of pages still w/o sidebar.

I get 25 from my list above. Might be 23.
 
I haven't found it a problem where there is a sidebar on the left. Both appear without problems.

Using my list it took me about 15 mins or less to paste in the sidebar in the templates when I set up a second install.
 
I can confirm that adding it to PAGE_CONTAINER does NOT work. I'm adding it to the bottom of the page, I also tried it just before the </xen:hook> tag.
 
I tried adding it to PAGE_CONTAINER. It only adds to a selection of pages. There are lots left without a sidebar - about half I think.

I'm in the process of learning how to do the whole collection in one go!
Stay tuned.
 
Then you tried it wrong....

Robbo that is totally unhelpful. If you want to give advice then give a proper detailed explanation.
Don't just sneer at others effort.
Yes you can use listeners and create hooks. Most admins don't know how. Also they/ we have far too many other jobs to do to spend time learning that level of cising until later when the board has settled down.
In the meantime this is a simple method that works.

UPGRADING
Not a big problem. I transferred to another install on the next series, and adding all the sidebar snippets took 15 mins following my own list. Bit boring yes but no big deal.
 
You can't put <xen:sidebar /> in PAGE_CONTAINER because that tag actually set a container parameter to use later and because you are already in THE CONTAINER template, your sidebar won't display correctly.

If you really want to put a sidebar everywhere you can use [bd] Widget Framework (oops, shameless plug). It will involve creating 1 new template containing your sidebar content then create a widget using Template (without wrapper), done!
 
xfrocks I looked at Widgwet Framework and it didn't suit me. It didn't give me the precise control of content I prefer. I do not like working with preset blocks someone else makes unless I can go in them and edit them freely.
However if you don't know php and you want a block containing such code then WF might be just what you need.
For my purposes wanting to place blocks of html data display the manual method is best.
 
xfrocks I looked at Widgwet Framework and it didn't suit me. It didn't give me the precise control of content I prefer. I do not like working with preset blocks someone else makes unless I can go in them and edit them freely.
However if you don't know php and you want a block containing such code then WF might be just what you need.
For my purposes wanting to place blocks of html data display the manual method is best.

WF has a html widget with and without wrapper, so you can put in there anything you want. Also, I think the new version also has the ability to include a template (or I might be wrong on that as I haven't upgraded yet).
 
Does anyone know how to get 'Staff Online Now' to show up in 'sidebar everywhere'? It looks like the staff online know part of the sidebar gets stripped automatically and shows only on the forum home.
 
xfrocks I looked at Widgwet Framework and it didn't suit me. It didn't give me the precise control of content I prefer. I do not like working with preset blocks someone else makes unless I can go in them and edit them freely.
However if you don't know php and you want a block containing such code then WF might be just what you need.
For my purposes wanting to place blocks of html data display the manual method is best.

I wanted a sidebar everywhere and wanted total control over displaying certain elements in certain locations. I find the widget framework is invaluable as it allows all this control without manual template edits. I display blocks of custom HTML in many positions around the site in the sidebar - you have access to widgets thaty will show a custom template and also there is the HTML widgets that allow you to use your own HTML - with or without the standard section wrapper.

It is also fairly easy to write your own widgets and utilise PHP - just pull any of the inbuilt widgets apart and you'll see right away how easy to extend it is.
It has to be better come update time??
 
I wanted a sidebar everywhere and wanted total control over displaying certain elements in certain locations. I find the widget framework is invaluable as it allows all this control without manual template edits.
You don't really need a widget framework to achieve the results you want without any template edits... Just use default Xenforo code and eliminate additional code processing. It took me 5min to write a very simple product, attached to this post (credit goes to Mike and Kier for making developer's life so easy):

1) Create the file library/Axivo/Sidebar.php with the following content:
Code:
<?php

class Axivo_Sidebar
{
	public static function renderSidebar($templateName, &$content, array &$containerData, XenForo_Template_Abstract $template)
	{
		$templates = array(
			'forum_list',
			'forum_view',
			'member_list',
			'online_list',
			'news_feed_page_global',
			'thread_view',
			'watch_threads'
		);
		if (in_array($templateName, $templates))
		{
			$params = $template->getParams();
			$containerData['noVisitorPanel'] = false;
			$sidebarTemplates = array(
				'sidebar_sponsors'
			);
			foreach ($sidebarTemplates AS $value)
			{
				$output = $template->create($value, $params);
				switch (empty($containerData['sidebar']))
				{
					case true:
						$containerData['sidebar'] = $output;
						break;
					default:
						$containerData['sidebar'] .= $output;
				}
			}
		}
	}
}
Feel free to add as many $sidebarTemplates you like into array or to set $containerData['noVisitorPanel'] to true if you want to hide the visitor panel in all pages.

2) Create the sidebar_sponsors and sidebar_sponsors.css templates.
Put inside sidebar_sponsors template this code:
Code:
<xen:if hascontent="true">
	<xen:require css="sidebar_sponsors.css" />	
	<div class="section infoBlock sponsors">
		<div class="secondaryContent">
			<h3>{xen:phrase our_sponsors}</h3>
			<xen:contentcheck>
				<xen:hook name="ad_sidebar_sponsors" />
			</xen:contentcheck>
		</div>
	</div>
</xen:if>

3) Add a Code Event Listener into template_post_render as Axivo_Sidebar::renderSidebar and you are done.

Final result:

sponsors.webp

As I said... nothing fancy, all in all pretty easy stuff.
Thank you Mike and Kier (sorry Mike, I still hate if/else, switch rulez!).

I attached the product for people who do not like to fiddle with the code. Included into sidebar_sponsors.css template is an example how to customize the sidebar width without editing any Xenforo params.

Please stop editing templates. :)
 

Attachments

Floren,
I installed your addon and activated.
All looks perfect, except it creates an empty "blank" sidebar.
( I checked sidebar_sponsors and sidebar_sponsors.css templates and both look fine).

Is there any option/permission/whatever I have to give it, to show the actual sidebar?
What could I do wrong ? ( I am a total newbie).

Thanks for any help in advance.
 
Top Bottom