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

How to insert a sidebar inline with the first post of a thread

Add a sidebar to your thread posts without taking up the entire right and side of the page.

RobinHood

Well-known member
#1
robinhood submitted a new resource:

How to insert a sidebar inline with the first post of a thread (version 1.0) - Add a sidebar to your thread posts without taking up the entire right and side of the page.

This is a guide on how to insert a sidebar inline with the first post of a thread. This means anything above it like the moderation tools, notices or the breadcrumb will still span the full width of the page content above the posts and the sidebar.

Before:
View attachment 33474

After:

View attachment 33476

Head to ACP -> Appearance -> Templates and find the thread_view template.

What we're going to do is taking all the code for the...
Read more about this resource...
 

RobinHood

Well-known member
#3
Yep, I'm pretty sure it will. Haven't had a chance to test it yet though as I'm still contemplating if I'm going to but ads there on my site. I'll give it a go when I finish dinner.
 

RobinHood

Well-known member
#4
robinhood updated How to insert a sidebar inline with the first post of a thread with a new update entry:

Extra instructions to insert sidebar into forum view

To insert the same sidebar inline with the first thread listed in the forum view head to:

ACP -> Appearance -> Templates and find the forum_view template.

Find the following code:

Code:
<div class="discussionList section sectionMain">
    <xen:include template="thread_list" />
</div>
   
<div class="pageNavLinkGroup">
    <div class="linkGroup">
        <xen:if is="{$canPostThread}">
            <a href="{xen:link 'forums/create-thread', $forum}"...
Read the rest of this update entry...
 
#6
Hi there - awesome! I was looking exactly for this for the forum_view. Unfortunately the code does not work with my style and slightly changed forum_view template. Could you help how to include the code?

Problem: The sidebar box is always shown above the forum view list. The code is different from the standard version for the -marked text:

Code:
<xen:title>{$forum.title}{xen:helper pagenumber, $page}</xen:title>
<xen:h1>{$forum.title}</xen:h1>
 
<xen:if is="{$forum.description} AND @threadListDescriptions">
    <xen:description class="baseHtml">{xen:raw $forum.description}</xen:description>
</xen:if>
 
<xen:navigation>
    <xen:breadcrumb source="$nodeBreadCrumbs" />
</xen:navigation>
 
<xen:container var="$head.canonical">
    <link rel="canonical" href="{xen:link 'canonical:forums', $forum, 'page={$page}'}" /></xen:container>
 
<xen:container var="$head.rss">
    <link rel="alternate" type="application/rss+xml" title="{xen:phrase rss_feed_for_x, 'title={$forum.title}'}" href="{xen:link forums/index.rss, $forum}" /></xen:container>
 
<xen:container var="$quickNavSelected">node-{$forum.node_id}</xen:container>
<xen:container var="$bodyClasses">{xen:helper nodeClasses, $nodeBreadCrumbs, $forum}</xen:container>
<xen:container var="$searchBar.forum"><xen:include template="search_bar_forum_only" /></xen:container>
 
<xen:if is="{$canPostThread}">
    <xen:set var="$newDiscussionButton"><a href="{xen:link 'forums/create-thread', $forum}" class="callToAction"><span>{xen:phrase post_new_thread}</span></a></xen:set>
    <xen:if is="!{$renderedNodes}">
        <xen:topctrl>{xen:raw $newDiscussionButton}</xen:topctrl>
    </xen:if>
</xen:if>
 
<xen:if is="{$showPostedNotice}">
    <div class="importantMessage">{xen:phrase message_submitted_displayed_pending_approval}</div>
</xen:if>
 
 
<xen:if is="{$renderedNodes}">
    <xen:include template="ad_forum_view_above_node_list" />
    <xen:include template="node_list" />
</xen:if>
 
 
<xen:hook name="forum_view_pagenav_before" params="{xen:array 'forum={$forum}'}" />
 
<xen:include template="ad_forum_view_above_thread_list" />
 
<div class="pageNavLinkGroup">
    <div class="linkGroup SelectionCountContainer">
    <xen:comment><xen:include template="forum_view_legacy_controls" /></xen:comment>
    </div>
    <xen:pagenav link="forums" linkdata="{$forum}" linkparams="{$pageNavParams}" page="{$page}" perpage="{$threadsPerPage}" total="{$totalThreads}" />
</div>
 
<xen:hook name="forum_view_threads_before" params="{xen:array 'forum={$forum}'}" />
 
[B]<div id="fore">[/B]
[B]<div class="discussionList section sectionMain">[/B]
[B]    <xen:include template="thread_list" />[/B]
[B]</div>[/B]
[B]<div class="fore_close"> &nbsp; </div>[/B]
[B]</div>[/B]
 
 
[B]<div class="pageNavLinkGroup">[/B]
[B]    <div class="linkGroup">[/B]
[B]        <xen:if is="{$canPostThread}">[/B]
[B]            <a href="{xen:link 'forums/create-thread', $forum}" class="callToAction"><span>{xen:phrase post_new_thread}</span></a>[/B]
[B]        <xen:elseif is="{$visitor.user_id}" />[/B]
[B]            ({xen:phrase no_permission_to_post})[/B]
[B]        <xen:else />[/B]
[B]            <label for="LoginControl"><a href="{xen:link login}" class="concealed">({xen:phrase log_in_or_sign_up_to_post})</a></label>[/B]
[B]        </xen:if>[/B]
[B]    </div>[/B]
    <div class="linkGroup"{xen:if '!{$ignoredNames}', ' style="display: none"'}><a href="javascript:" class="muted jsOnly DisplayIgnoredContent Tooltip" title="{xen:phrase show_hidden_content_by_x, "names={xen:helper implode, $ignoredNames, ', '}"}">{xen:phrase show_ignored_content}</a></div>
 
    <xen:pagenav link="forums" linkdata="{$forum}" linkparams="{$pageNavParams}" page="{$page}" perpage="{$threadsPerPage}" total="{$totalThreads}" />
</div>