XF 1.2 Adding links to dynamic banners above the forum

SchmitzIT

Well-known member
Hello,

I'm using a small hack to display a banner above a forum, when the user is in that particular forum. To accomplish this, I created a template modification doing the following.

Template: forum_view
Find:

Code:
<xen:if is="{$forum.description} AND @threadListDescriptions">
    <xen:description class="baseHtml">{xen:raw $forum.description}</xen:description>
</xen:if>

Replace with:

Code:
<xen:description class="baseHtml">
    <span class="forumbanner{$forum.node_id}"></span>
</xen:description>

This then allows me to add a banner in css:

Code:
.forumbanner1 {
    background-image: url(''myBanner.png');
    float: left;
    width: 728px;
    height: 90px;
    margin: auto;
}

However, that leaves me with just a banner image. Now I'd like to add a link to the banner. I tried using pseudo-elements to inject the html:

Code:
span.forumbanner1:before {
 content:<a href=\"https://www.okumafishing.com/resources/news\">;
}

span.forumbanner335:after{
 content:</a>;
}

However, that won't work as the pseudo-elements do not allow for adding HTML. Does anyone have an idea of how I could possibly dynamically add these links?

Thanks :)
 
Why are you trying to use css?
Why not add the condition and the link to
Code:
<xen:description class="baseHtml">
<span class="forumbanner{$forum.node_id}"></span>
</xen:description>
?
 
Top Bottom