Interspire Product Knowledge Base

Would you like to...

Print this page Print this page

Email this page Email this page

Post a comment Post a comment

Subscribe me

Add to favorites Add to favorites

Remove Highlighting Remove Highlighting

Edit this Article

Export to PDF

User Opinions (321 votes)

99% thumbs up 0% thumbs down

How would you rate this answer?

Thank you for rating this answer.

Template Wrapping External Scripts/Pages

This entry applies to Website Publisher 4.5 and below. Only method 3 works on Website Publisher 5.0 or above.

Template Wrapping

A unique feature in this application is the ability to automatically wrap the template around any HTML file so it looks exactly like every other page in the application. There are two methods for doing this that may suit different situations.

  • Method 1: The 'html' directory
  • Method 2: Inserting PHP code into your page/script
  • Method 3: Inserting header/footer code into your other page/script

Method 1: The 'html' Directory

This method involves placing any html or php page into a specific directory and access it via a specific URL. This is how it works:

Step 1. Inside the application's base directory there should be an empty 'html' folder (You can create the html folder if one doesn't exist). Inside this directory you can place any HTML or PHP file. For example, let's say we had a HTML file called "readme.html" which contained the following code:

<b>This is my readme html file</b></br></br>
This is line 2 of my readme html file
It looks like this:
We would place this readme.html file inside the 'html' folder.

Step 2. You can now access this file being wrapped into the design by going to Note the added "/pages/" part of this URL. This allows the application to parse the file and wrap the template around it. If you were to just go to you would only see your original file.

It will now look like this:

Your current template will automatically be wrapped around this file. Note that this will look different depending on which template you're working with.

Method 2: Inserting PHP code into your page/script

This alternate method lets you have your PHP script placed anywhere. This method will only work with PHP files. If you wish to use a HTML file, you will need to rename its extension to .php for this method to work.

Step 1: Open your .php file in a text editor and paste this code at the very top of the file, before anything else:

# set the callback function which gets run when the PHP script finishes

# include the init.php file to get all the application resources

# set up the global to put into the template, we're essentially replacing
# a global placeholder with a non-standard placeholder that won't be
# automatically replaced
$GLOBALS['Content'] = "%%CONTENT%%";
$template = &GetClass('template');

# set up the page title and specify to use the Other.html layout file

# save the data into our variable. We're using __ to keep it unique and the
# chances that it will be overridden by a different application low
$__TemplateData $template->ParseTemplate(true);

# this is the function that will be used when the PHP script is finished. It wraps
# all output into the layout file retrieved above.
function ob_callback($EndOutput) {
In order to get this to work, you will need to make one adjustment. Within the code you will see this line: include('init.php');
This is the path to your application's init.php file. If your PHP file is located in the same directory as this file, you can leave the line as it is. If you are in another directory, you will need to alter this line to suit your file's location. For Example, if you're script is in a sub directory, you will need to alter this line to be: include('../init.php');
You will then be able to access your PHP file via its normal URL but now it will be wrapped inside the application design. If you wish to alter the design, the file you need to change is the Other.html layout file.

Method 3: Inserting header/footer code into your other page/script
This method is a bit less complicated then the method above, however if you're inserting this into a PHP script that might use a die(); or exit; command, Method 2 will ensure the footer is included in the output, while this method won't.

This method just includes the header and footer of your website's template. The file you insert these into need to be PHP file. To include the header, use:

echo file_get_contents('');

and then to include your footer use:

echo file_get_contents('');

You can also use the above 2 two URLs (without the file_get_contents() function call) with the 'Embedded 'template in Interspire Knowledge Manager.

 Include external files and scripts using the Include placeholder

Inside any layout or panel file you can use an include tag to include files outside of the application. They will be rendered inside your web site template. This is similar to the Template Wrapping feature above, but allows you to have more control. The Include function allows you to include HTML files as well as script files such as PHP. This is extremely useful if you want to include third party scripts such as a photo gallery or voting poll.

The Include function allows you to include local files that are found on your web server or a URL to an external file.


Basic Usage:
%%Include.myfile.html%% Full path local file:
%%Include./home/mysite/public_html/otherfiles/myfile.html%% Relative Path Local file (notice the 3 dots? You need to keep in mind that the function requires a dot right after the word Include):
%%Include.../../../otherfiles/myfile.html%% External URL:

Related Articles

No related articles were found.


No attachments were found.

Powered by Interspire Knowledge Manager - World's #1 Best Selling FAQ and Knowledge Base Software