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

Sidebar widgets

Discussion in 'XenForo Questions and Support' started by attilakristo, Dec 1, 2011.

  1. attilakristo

    attilakristo New Member

    Hi All,

    Hope someone can help me with what I would like to achieve!

    My goal:
    I'd like to add a few simple, external widgets for my forum's right-side sidebar, to every page of it.
    By simple, external widgets, I mean html-code based widgets like the following:
    - weather ( like this )
    - world clock ( like this )
    - currency/exchange rates ( like this )

    Background:
    I have searched through xenforo forums for solutions, but what I found was a bit messy for me, and seemed hard for me to overview (like 117 thread-pages for an addon), and so I could not find the steps that are needed to do the above - with or without an addon - even though I kept searching and reading for 2+ hours.

    Another (big?) problem is that I do not know how to code php, xml, html, so I'm a very basic user in terms of modifying codes/xml files, etc..

    Other infos:
    - The added external widgets would be visible and accessible to every user of the forum ( which is less than 10 members), so no complication with premium or whatever member accounts.
    - I have not upgraded to XF 1.1 - yet.

    Aaaand, my question would be:
    Could someone please direct me to a place where I can find easy-to-follow-steps in order to achieve the above described goal ? Or kindly write me a list of steps?

    If what I ask for is too hard to achieve to be available for free, I'd consider paying for this or the info, the main thing is that I'd like to be able to achieve the goal for my forum members relatively easy :)

    Thanks so much for any input.

    Attila
     
  2. Brogan

    Brogan XenForo Moderator Staff Member

    Do this for each widget you want to add.

    1. Go to ACP -> Styles -> Templates and create a new template, let's call it sidebar_widget_weather.
    2. Copy the widget code into the template.
    3. if you want the widget on every page, edit the PAGE_CONTAINER template and add the new widget template just above {xen:raw $sidebar} using this code: <xen:include template="sidebar_widget_weather" />

    That's it.
     
    Biirds likes this.
  3. RobParker

    RobParker Well-Known Member

    The alternative is to use XenPorta (that 117 page addon you mentioned :p) which if you're also planning to have a portal as your landing page would make sense (and there are enough people to guide you through it) but if not Brogan's solution is what you want.
     
  4. Morgain

    Morgain Well-Known Member

    It sounds like the OP doesn't need it but for others less confident or experienced I have made a tutorial on the steps to do simple sidebars.
    http://xenforo.com/community/threads/sidebar-widgets.24110/

    My description also means making a new template
    but then needs to add the code snippet that calls the new template on to various separate templates (listed).Quite laborious compared to using P{AGE_CONTAINER :(

    Brogan does PAGE_CONTAINER really add to ALL the forum pages?
    As in search forms, search results, create thread, Pages ...
    what about Conversations that have their own existing sidebar?
    Ah tested - yes the PAGE_CONTAINER does indeed put it everywhere. I note it also covers an add-on like Jaxel's wiki.

    Except What's New?
    but I couldn't see how to do that by single template addition either as the code in View Source doesn't give me a template name.
    Any possibility on this? I for one want my navigation menu on ALL pages without exception.

    The one issue I have with the PAGE_CONTAINER method as described is that the additional widget or section is placed BELOW the existing standard XF sidebar.
    That pushes the addition quite far down. It goes below the avatar section, then Staff Online Now, Members I follow/ other members online/ Statistics/ Share this page.

    OK I've done some tests. I made a plain text template that just says TESTING in large font. I named it "aaatest"

    In PAGE_CONTAINER placing the snippet to call aaatest like this
    Code:
    <div class="sidebar">
    <xen:include template="aaatest" />
    puts the aaatest section rigt at the top of the sidebar above the user avatar section.

    In PAGE_CONTAINER placing the snippet to call aaatest like this
    Code:
    <div class="sidebar">
    <xen:include template="aaatest" />
    puts the aaatest section right at the top of the sidebar above the user avatar section.

    None of the other insertions in that area of PAGE_CONTAINER code make any difference - it still appears at the top - until the code line goes as Brogan says above.
    Code:
    {xen:raw $sidebar}
    <xen:include template="aaatest" />
    puts the aaatest section right at the BOTTOM of the sidebar under all the standard XF sections.

    Since this PAGE_CONTAINER insertion is so much more powerful and fast than manually inserting in all the different page templates - how can we adjust it to insert our own section part way down the standard XF sidebar?

    1. Below the avatar section above the staff/ follows/ members online sections.
    2. Below the the staff/ follows/ members online sections, above Forum Statistics.
    3. Below Forum Statistics, above Share this page.

    This would finish off creating a superb everywhere sidebar system. Maybe one day someone can put it in the admincp as a set of sidebar options but this much will do nicely until then.



     
  5. principia

    principia Well-Known Member

    have you tried the ad_ templates? I think they work on all pages.
    Im using them for a navigation list.
     
  6. Bellinis

    Bellinis Active Member

    Attilakristo, in case you'd like a simple convertor for just one currency, then I could share my script with you. See it in action here: www.tsjechie.net
     
  7. Morgain

    Morgain Well-Known Member

    I haven't but does that allow us to insert it where we want in the sidebar?
    I think it places at the bottom again.
     
  8. principia

    principia Well-Known Member

    you have different sidebar templates.
    top. bottom and under visitor panel.
    i use the ad_sidebar_top
     
  9. Morgain

    Morgain Well-Known Member

    I tried a sidebar template but it doesn't add to the pages unless we add the sidebar snippet.
    So if I still have to add
    Code:
    <xen:sidebar>
    </xen:sidebar>
    on all the templates I might as well add
    Code:
    <xen:sidebar>
    <xen:include template="nodemenu" />
    </xen:sidebar>
    Now we just need a solution to What's New which this does not cover.
     
  10. attilakristo

    attilakristo New Member

    Wow. I'm impressed and happy with all the help you've given. Thank you very much!
    I was able to do what I was aiming for within half an hour.

    Also, this article could be useful to anyone looking for a guide in sidebar/template editing - similar to what I was doing.
    Thanks again!

    @Bellinis > Very nice script! Also looks/integrates good. My members (10) could definately make use of this, as although I have something similar on our forum at the moment, It's ugly as hell: http://cl.ly/2H0k0V05123w352R3c3p , so I'd be very happy if you could share it with me if it's free. If it's not I'd have to check with my members to "crowd-fund" it in the future it if they need it.
    I'd use it twice if possible: one for USD/HUF, and one for AUD/HUF. Is this something that could be done?
     
  11. Morgain

    Morgain Well-Known Member

    Yes that's the Xenfans article I meant - just so's it's clear to any other reader there is one item mentioned here not two.
     
  12. Biirds

    Biirds Member

    Thanks! I have now added a Twitter-widget =)
     

Share This Page