WSN Forum en-us Adding a Right Side Vertical Banner How to add a banner ad to the right side of all pages. Mon, 07 Jul 2014 10:51:14 GMT
To put a vertical banner on the right, you'll need to change the layout to create room for it. Go to Admin Panel -> Themes -> Manage Templates -> "Wrapper". The simplest approach would be to change
<div style="display: table;">
<div style="display: table-row;">
<div style="display: table-cell; vertical-align: top;"><!-- BODY GOES HERE --></div>
<div style="display: table-cell; width: 200px; vertical-align: top;">{SHOWAD[2]}</div>

Change 200px to whatever the width of your vertical banner is and 2 to whatever slot number the ad is in the ad manager. To make the HTML cleaner, you could optionally move those inline style definitions to the stylesheet.]]>
Twitter Feeds How to integrate a twitter feed into your templates. Sun, 18 May 2014 09:47:16 GMT Note: Requires WSN 9.0.9 or later.

Integrating the content of a twitter feed can give your site fresh content without effort. You can make a feed of your own tweets, or of another twitter user, or of everyone using keywords related to your topic.

Twitter requires that you authenticate with a bunch of special tokens, so you'll need to set these up first. Create a new app at and then generate an access token for it. Copy the api key, api secret, access token and access token secret into the twitterapikey, twitterapisecret, twitteraccesstoken and twitteraccesstokensecret tweaks at Admin Panel -> Settings -> Tweaks Editor in WSN. If you don't enter these details, you'll be using the default wsnphp access info which may quickly hit the requests limit and cause you problems.

Next, go to Admin Panel -> Settings -> Social and create your feed at the bottom. If you want to show tweets by a particular user, type @username. For a hashtag, type #hashtag. For a plain search just type the search term. After submitting, you'll be presented with the template code you'll need to copy to where you want the tweets displayed.

The following template variables are available for tweets:

{TWEETPROFILEIMAGEURL} - The user's profile image.
{TWEETNAME} - The username.
{TWEETSOURCE} - The source of the tweet, such as web or mobile.
{TWEETTEXT} - The actual text of the tweet.
{TWEETTIME} - The time and date it was tweeted.
{TWEETIMAGEURLBOOL} - True if there's an image in the tweet, false if not.
{TWEETIMAGE} - The URL of an image included in the tweet, in case you want to display images (this can mess up your layout so be careful).

For educational purposes, here's an example using everything:

<div class="socialfeed">
<h3>@wsnphp on twitter</h3>
<!-- BEGIN TWITTER FEED @wsnphp|5 -->
<div class="tweet">
<div class="tweetheader"><img src="{TWEETPROFILEIMAGEURL}" class="tweetprofileimage"><b>{TWEETNAME}</b> via {TWEETSOURCE}</div>
<div class="tweettext">{TWEETTEXT}</div>
<div class="tweettime">{TWEETTIME}</div>
<IF {TWEETIMAGEURLBOOL}><div class="tweetimage"><img src="{TWEETIMAGE}"></div></IF>
<div class="clear"></div>
<!-- END TWITTER FEED @wsnphp|5 -->

Please note that twitter feeds will be cached for one hour in order to speed the display and lower the chances of hitting the API use limits. To bypass the cache, you can add a nocaching=1 parameter to the URL of the page.

Totals of Each Type on Current Page Checking how many topics of each type are on the current page. Fri, 08 Jan 2010 22:58:00 GMT
<IF {NUMPREMIUMLINKSONPAGE}>there are {NUMPREMIUMLINKSONPAGE} oremium links here on this page</IF>

This works in the 'display topics in forum' template and also in the 'search topics' template.]]>
Tabbed Details Page Splitting the topic details into tabs. Thu, 17 Dec 2009 16:31:38 GMT custom templates for each tab.

For tabs with css classes tab and activetab (for the currently active one), use this tab bar code in each template which is part of the tabs:
<div class="tabset">
<a href="{LINKDETAILSURL}" class="<IF {CURRENTURLCONTAINS[action=detail]} and not {CURRENTURLCONTAINS[custom]}>active</IF>tab">Main</a>
<a href="link.php?action=detail&id={LINKID}&custom=yes&TID=map" class="<IF {CURRENTURLCONTAINS[map]}>active</IF>tab">Map</a>
<a href="link.php?action=detail&id={LINKID}&custom=yes&TID=photos" class="<IF {CURRENTURLCONTAINS[photos]}>active</IF>tab">Photos</a>

In this example we have custom templates called map and photos which act as the second and third tabs, while the regular details template is the first tab. We can cut and paste the maps and attachments code from the details templates into the custom templates.

Add .tab and .activetab to your stylesheet to style the tabs to look as desired (a background-image is probably the simplest approach to getting a professional look).]]>
Unique Settings and Switches For a Template Set Changing settings, switches and other things for one template set without changing for others. Mon, 05 Nov 2007 19:50:21 GMT
$flags['forcestyle'] = 'somestyle'; // force styles/somestyle.css to be used
$switches['onlineusers'] = 0; // turn off online users
$switches['maintoplist'] = 0; // turn off the index toplist
$settings->catcols = 3; // use three columns of forums
$settings->linkcols = 0; // don't use columns for articles

The changes you specify in the file will be in effect whenever the template set is being used, and will fall out of effect whenever a different template set is used.

Now, suppose you want the PHP to run only at the time of installation, still allowing people to change their settings later. You can accomplish this with an installphp.wsn file in the template set. For example:
$settings->linkcols = 1;

It'll be called once during installation, then deleted. (Note: Don't use PHP opening/closing tags, as this will be loaded as text and run with eval() in order to prevent it from accidentally being run multiple times). You can also perform more complex tasks, like changing the default language or removing all but one language, in your installphp.wsn. In fact, when deploying internally you can use it to automate the whole process of customizations you do when you install a new site.]]>