1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Lack of Interest Sidebar everywhere

Discussion in 'Closed Suggestions' started by Morgain, Feb 5, 2012.

  1. Morgain

    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.
    Markos and ankurs like this.
  2. Mike Creuzer

    Mike Creuzer Well-Known Member

    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 ;)
  3. Slavik

    Slavik XenForo Moderator Staff Member

    :confused: 25? Where do you get that figure from.

    I have a sidebar everywhere with 12 templates customised (excluding css)
  4. Robbo

    Robbo Well-Known Member

    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.
  5. Morgain

    Morgain Well-Known Member

    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.
  6. Morgain

    Morgain Well-Known Member

    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.
  7. Robbo

    Robbo Well-Known Member

    Then you tried it wrong....
  8. hathway

    hathway Member

    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.
    Morgain likes this.
  9. Morgain

    Morgain Well-Known Member

    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.
  10. Morgain

    Morgain Well-Known Member

    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.

    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.
  11. xfrocks

    xfrocks Well-Known Member

    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!
  12. Morgain

    Morgain Well-Known Member

    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.
  13. Sadik B

    Sadik B Well-Known Member

    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).
  14. xfrocks

    xfrocks Well-Known Member

    You are right ;)
  15. TheBigK

    TheBigK Well-Known Member

    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.
  16. Rob

    Rob Well-Known Member

    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??
  17. Floren

    Floren Well-Known Member

    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:
    class Axivo_Sidebar
    	public static function renderSidebar($templateName, &$content, array &$containerData, XenForo_Template_Abstract $template)
    		$templates = array(
    		if (in_array($templateName, $templates))
    			$params = $template->getParams();
    			$containerData['noVisitorPanel'] = false;
    			$sidebarTemplates = array(
    			foreach ($sidebarTemplates AS $value)
    				$output = $template->create($value, $params);
    				switch (empty($containerData['sidebar']))
    					case true:
    						$containerData['sidebar'] = $output;
    						$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:
    <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:hook name="ad_sidebar_sponsors" />
    3) Add a Code Event Listener into template_post_render as Axivo_Sidebar::renderSidebar and you are done.

    Final result:


    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. :)

    Attached Files:

  18. Marcus

    Marcus Well-Known Member

    I am here with Mike for the if/else. Great addon and very nice tutorial. Thanks!
  19. Floren

    Floren Well-Known Member

    switch() is faster, by very little but it is. :)
    Marcus likes this.
  20. elbav

    elbav Member

    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.

Share This Page