Latest Register Log In

+ Advanced Search

Details

Show Custom Template Anywhere
By
Oct 31, 2004 (Edited Mar 11, 2014)

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 category display page, get both REQUEST and GET for action to equal 'displaycat' and then set catid to equal the desired category number.




Description Showing your content outside of the WSN directory.
Rating
Views 2,125 views. Averaging 1 views per day.

Previous Article | Next Article