• This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn more.
  • This forum has been archived. New threads and replies may not be made. All add-ons/resources that are active should be migrated to the Resource Manager. See this thread for more information.

Sidebar everywhere + custom content

Morgain

Well-known member
#1
This is not an add-on. Until someone does a proper add-on or we have it in core here's my workaround.
I'm not posting anything original.
The main strategy comes from Floris Xenfans here
http://xenfans.com/threads/article-extending-on-the-xenforo-sidebar.1241/
This is beautifully written so even I understood! But my post here puts together the simplest steps for managing a sidebar for novice admins as the system works at present.

###########################
To add the standard XF sidebar
add the following code at the bottom of page templates.
For example add it to the bottom of sidebar_online_users
Code:
<xen:sidebar>
</xen:sidebar>
This gets you the standard sidebar block with your avatar at top
under that - who's online (staff, your follows, members)
under that Forum Statistics
under that Share this page.

To access the template to add the code
Admincp/ Appearances/ Templates
Copy the template name in the little box top of the bar.

#############################
Templates list to add the snippet.
sidebar_online_users --- only <xen:include template="nodemenu" />
forum_list ---- only <xen:include template="nodemenu" /> but add near top before stats
forum_view --- (selected forum page)
category_view --- (selected category page)
thread_view
thread_create
pagenode_container
search_form
search_form_post
conversation_view
conversation_add
help_index
help_wrapper
account_wrapper
account_preferences
account_alerts
news_feed
news_feed_page_global
account_likes / likes_summary –--- did not work on Likes Received but wrapper did it
watched_threads
account_personal details
pagenode_container
find_new_threads ---- only add <xen:include template="nodemenu" /> above the </sidebar>


If you can add any template names for standard pages to this list please do.
I'll update here from your post if I can. [No new updates yet]

Q!uick method - but limited:
Add the snippet to PAGE_CONTAINER
This means some of the above get it so you don't need to add to all.

################################################
To find the name of a templates to add the snippet of code
open the page in your XF forum
on your browser - View/ Page Source (Ctrl+ U)
In the html page that opens separately go down past
Code:
<body>
on the left
- use Ctrl+F or Edit/ Find to locate it.

Then look for
Code:
<div id="content" class="NAME">
NAME is the template name you want.
(Thanks to Brogan for this powerful basic help.)

##################################################
BUT I haven't found how to add the sidebar snippet to the What's New page
because View Source gives me
Code:
<div id="content" class="">
so I dunno what to do.

Anyone?

If you can help I'll add it in above with thanks.

###################################################
To add your own block to the sidebar
###################################################
- so you only have one place to edit/ update it for all the pages where you add your sidebar:

First create your own template. Not as scary as it sounds!

Admincp/ Appearances/ Templates
Top right click button Create New Template
It needs a name you can remember connected to the block you'll add.
My custom block is a menu list of pages and forums - the basic top level node tree. So I called my template "nodemenu."
The name must be like a password: one word/or a sequence of letters and numbers. It can also use underscore_ or hyphen- but must have NO spaces.

Here is an idea of what I put in the content box.
Code:
<div class="section" align="center">
<div class="secondaryContent">
TABLE CONTAINING LIST OF LINKS
</div>
</div>
The two code lines at the top come from Floris. This makes your block look like other sidebar blocks. They MUST have the "divs" at the bottom, one for each line at the top.

In between you can put the stuff you want - your Content.
To make separate lines of plain text add
Code:
<br />
at the end of a line. Otherwise it'll display as one long line even if you use Return on the keyboard.
Use html - make a table - or link to a graphic.

Save your template.
Now instead of putting the code above for the standard XF sidebar in all the types of pages ...
add a line of code in the middle.

Code:
<xen:sidebar>
<xen:include template="NAME" />
</xen:sidebar>
NAME is the name of your own new template.
For example my template to insert a list of links to the node tree is called "nodemenu."
So my code for adding to pages is
Code:
<xen:sidebar>
<xen:include template="nodemenu" />
</xen:sidebar>
Go through all the pages on the list up top here in this post adding this to the bottom.
Once you've done it, all you have to do to change your menu block on all the pages, is edit the new template you made. So for example I need to edit my "nodemenu" template.

I know this is very simple and nothing original to me. I think it's useful for novice admins to have a collection of bits like this in one place with all the steps spelled out thoroughly.
 

toodlez

Active member
#2
I did this, and my users online block will not display properly... it says 0 users and 0 guests online when that isn't the case
 

Morgain

Well-known member
#3
I'd suggest you comment out whatever you added already to sidebar_online_users
<!-- YOUR CONTENT -->
Check all is well by saving and looking at frontend.

Then above it but AFTER the last line of original code put the standard sidebar code.
Code:
<xen:sidebar>
 
</xen:sidebar>
Does the online users show now?
It should do as this is now just XF code.

If it does work there's something about how you added your code that interfered.
Add each separate bit in steps to see what is OK and what is not.

If it doesn't work with the two line snippet above then you need to ask to get the original page code at the end of the template.
Replace the last few lines as your insertion probably altered something it shouldn't. Every comma, every bracket, every dot counts!
 

Morgain

Well-known member
#8
On another note, you can always use [bd] Widget Framework http://xenforo.com/community/threads/bd-widget-framework.11324/ with its HTML widget to create basically any kind of widget yourself, in every page, with order and such and no template edit :D

PS: Sorry for the advertisement :X3:
xfrocks no problem re "advertisement"

You know I never even knew your addon was about the sidebar!
I read "[bd] Widget Framework" and I just thought oh that must be a clever developer tool for designing stuff for addons, so I didn't open the thread to read.
I'm reading it now. Still looks a little bit intimidating but maybe I can use it.
 

Morgain

Well-known member
#9
Updated list of templates to add the sidebar code.

I decided to stick with this method as I feel more in control of what I'm doing.
 
R

ragtek

Guest
#10
hm, if you want to have the sidebar EVERYWHERE =>


create a event_listener at template_post_render with
PHP:
$containerData['sidebar'] = 'my sidebar content....';
[ot]
another hint:
if you want to remove the visitor panel, you can do this with the event listener too;)
PHP:
$containerData['noVisitorPanel'] = true;
[/ot]