WSN Knowledge Base
Featuresspacer Showcasespacer Reviewsspacer Demosspacer Purchasespacer Manualspacer Support
Unique Settings and Switches For a Template Set
Unique Settings and Switches For a Template Set
By Paul

Sometimes you'll want particular switches to be off in one template set and on in another, or particular settings to be changed. You can do this by placing a forceswitches.php file in the template set. Example:
<?php
$settings->stylesheet = '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 categories
$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. Since 4.2.0 you can accomplish this with an installphp.wsn file in the template set. For example:
$settings->linkcols = 1;
$settings->update('linkcols');

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).

Rating:


5/5 based on 1 vote. The median rating is 5.

Submitted: 11/05/07 (Edited 06/03/08)

Description: Changing settings, switches and other things for one template set without changing for others.

Views: 229 views. Averaging 1 per day.
In the most recent 30 day period, there've been 11 views.

Next Article


Home    |    Features    |    Showcase    |    Reviews    |    Demos    |    Purchase    |    Manual    |    Support