Latest Register Log In

+ Advanced Search

Show Custom Template Anywhere

Show Custom Template Anywhere
By
10/31/04 (Edited 03/11/14)

The code:
<?php
/* Supply the path to WSN and the name of your template on the lines as requested */
$pathtowsn = '/full/file/path/'; // same as the uploadpath value in your wsn config.php file but without the 'attachments/' part
$yourtemplatename = 'mytemplate.tpl'; // the template, located in the 'custom' subdirectory of your templates directory, that you want to display
$usewrapper = 'yes'; // set to 'no' if you don't want to show the WSN wrapper

$curr_path = getcwd();
chdir($pathtowsn);
require 'start.php';
if (!$template) $template = new template('custom/'. $yourtemplatename);
require 'end.php';
chdir($curr_path);
?>


Fill in the $pathtowsn and $yourtemplatename values there and save it as yournamehere.php in whatever directory you have in mind.

Want it to apply over a particular page? Replace
require 'start.php';
if (!$template) $template = new template('custom/'. $yourtemplatename);
require 'end.php';
with
$_GET['custom'] = 'yes';
$_GET['TID'] = 'yourtemplatename';
$_REQUEST['TID'] = $_GET['TID']; $_REQUEST['custom'] = $_GET['custom'];
require 'index.php';


Change index.php to the php file you want, and set the appropriate GET parameters you want to pass besides custom and TID. For example, to overlay on a particular forum display page, get both REQUEST and GET for action to equal 'displaycat' and then set catid to equal the desired forum number.




Description Showing your content outside of the WSN directory.
Rating
Views 2295 views. Averaging 0 views per day.