The Interface
Quick Start Guide
Creating Pages
Opening and Editing Pages
Uploading and Managing Files
Menu Display System
Site Templates
Shopping Cart & eCommerce
Event Calendar
eNewsletter Module
Database Table Manager
Secure Users
Site Data Tables
Photo Album
Site Statistics
Blog Manager
Webmaster Menu
Custom Web Forms
Custom PHP Includes
Programming structure
Custom HTML and PHP within the Page Editor
Custom Shipping Include
Custom Gateway Included
Custom Invoice Include
Custom Template Include
Custom Detail Page Include
Resources for Help
Search Engine Optimization
Useful Web Resources
Default Style Sheet File
Built-In Javascript Functions
Frequently Asked Questions (FAQs)
Online Users Manual Search Manual for:  
Custom PHP Includes
Custom HTML and PHP within the Page Editor

Any include script can be placed on a page within the page editor. These scripts can process anything from displaying of data from a database table to simply custom formatting a table display beyond the scope of the page editor.

Please note that custom HTML files are processed by the Pro Edition when placed within the page editor and can be edited within the “text editor” once saved. In some instances this changes the desired output once edited from the “text editor” and re-saved. You may add the following as the first line of your custom HTML script to turn off “text editor” capability:

<!– NOEDIT -->

Custom PHP script (.php/.inc) files are not editable via the Pro Edition in any way and will simply be shown as an object.

Let’s assume we have created a database table through the Pro Edition that contains a series of “partner websites” in which we want to link to and log to the database table each time someone clicks on the link.

The database table would be named UDT_PARTNER_LINKS. The field data can be viewed through the Pro Edition by going to “Site Data Tables”.

Remember, the database system automatically appends the fields PRIKEY, AUTO_IMAGE and AUTO_SECURITY_AUTH to any table created. Using the “Database Manager”, let’s populate our table with a couple of partner sites to start with.

Now, let’s write the script that we will place on the page to display these links to our site visitor and log the click-thru.

Remember, your custom include is executing within the pgm-realtime_builder.php program, so any variable data that is present can be used. This also means that since we are already “connecting” to the mySQL database, there is no need for our script to re-connect.

The major issue we have to deal with is how to log this click-thru and make it seamless to the site visitor. Therefore, we will have to “re-call” our custom include to accomplish this, but we don’t know what page we’re going to place this script on yet. Plus, if this is for one of our clients, he may want us to move it to another page one day. There is a variable that already exists within the product as our script is executed that will help us determine this information:

$pr Page Request Variable housing the “name” of the page that is being viewed. It is passed to the index.php script when a menu item or link is pressed.

Now, let’s write the script:

<?php

##############################################
## First let's display the links in a nice
## format for our visitors whether we process
## the actual link step or not, because
## ultimately, we are simply redirecting to
## this same page anyway
##############################################


$result = mysql_query("SELECT * FROM UDT_PARTNER_LINKS");

echo "<TABLE BORDER=1 CELLPADDING=3 CELLSPACING=0 WIDTH=100% ALIGN=CENTER>\n";

while ($row = mysql_fetch_array($result)) {

## Create Link HTML to process the next step when clicked.
## Remember, the $pr variable is already in use by the system

$link = "<A HREF=\"index.php?pr=$pr&process_step_two=y&link=$row[PRIKEY]\">";

## Display this partner to the screen

echo "<TR>\n";
echo "<TD ALIGN=LEFT VALIGN=TOP>$row[PARTNER_NAME]</TD>";
echo "<TD ALIGN=LEFT VALIGN=TOP>". $link . "$row[WEBSITE_LINK]</A></TD>\n";
echo "</TR>\n";

} // End While

echo "</TABLE>\n\n";##############################################
## Now process step 2 because we set the value
## to "y" via our link in step one
##############################################

if ($process_step_two == "y") {

## Update the "click-thru" for the PriKey id that
## was passed to us via the link

$result = mysql_query("SELECT WEBSITE_LINK, CLICK_THRU_COUNT FROM
UDT_PARTER_LINKS WHERE PRIKEY = '$link'");

$tmp = mysql_fetch_array($result);

## What is the current count for click-thru and
## what URL are we directing the end-user to

$current_count = $tmp[CLICK_THRU_COUNT];
$website_url = $tmp[WEBSITE_LINK];

## Increment the Count based on this request

$new_count = $current_count + 1;

## Write the new count back to the table

$result = mysql_query("UPDATE UDT_PARTNER_LINKS SET
CLICK_THRU_COUNT = '$new_count' WHERE PRIKEY = '$link'");

## Insert Javascript that takes user to partner site

echo "<SCRIPT LANGUAGE=JAVASCRIPT>\n";
echo " window.open(\"$website_url\",\"partnerwin\");\n";
echo "</SCRIPT>\n";

} // Done with step two

?>