DanPHPSupport

Integrating DanPHPSupport into your site

Chances are that if you currently have a website, you'd like to be able to integrate DanPHPSupport into it. This allows DanPHPSupport to seamlessly blend in, giving visitors to your site a better experience. Luckily, DanPHPSupport makes it very easy to do this. To do this, you'll need to have a header and footer from your current website. Basically, the header is from the first <html> tag up to where the content actually begins (where you'd like DanPHPSupport to appear). The footer is from the end of the actual content up to the end of the page. You'll end up with the site being like:
[header - Company logo, etc.]
[DanPHPSupport page]
[footer]

All of the main templates used by DanPHPSupport are stored in the includes/templates.php file. So, in order to implement our own headers and footers, you'll need to open this file. Note that before you make any changes, please be sure to make a backup of the current file! After going past all the comments at the top of the file, you'll come across the header. By default, the header looks like:

function pageHeader($header = "") {
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta content="text/html; charset=ISO-8859-1" http-equiv="content-type" />
<meta name="Generator" content="DanPHPSupport" />
<meta name="Author" content="Daniel Lo Nigro, DanSoft Australia" />
<link rel="stylesheet" href="style.css" type="text/css" />
<!-- Script for BBCode editor used on reply pages -->
<script src="BBCodeEditor.js" type="text/javascript" language="JavaScript"></script>
<title><?php echo $header ?></title>
</head>
<body>
<h1><?php echo $header ?></h1>

<?php
}

So basically, the actual header (in blue above) starts after the ?>, and goes all the way until the final <?php. The bits in red above are special - Wherever that piece of code is encountered, the title of the page is printed out. Additionally, there is also one other important component: The <script> tag (<script src="BBCodeEditor.js" type="text/javascript" language="JavaScript"></script>). This is basically the script used for the BBCode editor. Without it, the BBCode editor will not work properly, so don't forget it!

To implement your own, first delete the current one, and then paste your code in (but be sure to not delete anything else!). It will then look like:

function pageHeader($header = "") {
?>
[ Your code here ] <?php
}

As mentioned above, just make sure you include the BBCode JavaScript.

Once that's done, you need to do something similar for the page footer. The footer code is a lot easier, though! The default code looks like:

function mainPageFooter() {
echo footer();
?>
</body>
</html>

<?php
}

Again, the line in red is special. This red code prints out the footer at the bottom of every page (the DanPHPSupport one), which you should leave in. The most important piece is the blue section - This is the actual HTML code. Again, replace this with your own. You'll end up with:

function mainPageFooter() {
echo footer();
?>
[ Your code here ]
<?php
}

And that's it! Refresh the page, and if you've done everything correctly, it should be working fine. If you have any troubles, please feel free to email me :)



Hosted by
SourceForge.net Logo
Last Modified Friday, October 13, 2006 10:05 PM