Print

Creating a New Site



A nuBuilder site consists of a database, a login page and two PHP configuration files.

nuBuilder requires several pre-populated tables to exist in the database for the system to work. Each of these tables is prefixed with zzsys_. A blank nuBuilder site called 'sample' is included in all downloads of nuBuilder, this contains all of the required tables.

The login page and configuration files live in their own directory inside the db directory where nuBuilder was installed, for example, [NUBUILDER WEBROOT]/db/mysite/ . The requirements for each of these files and some examples are detailed below.


index.php


This is the login page for the nuBuilder. A basic template is provided below.

<?php
 
$dbfolder = "mysite";
 
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<body on<x>load='document.forms[0]["u"].focus()'>
  <form name='index' method='POST' action='../../productionnu2/formlogin.php?x=1&d=db/<?php echo $dbfolder; ?>'>
	User Name <input type='text' name='u'><br />
	Password <input type='password' name='p'><br />
	<input type='submit' class="button" value="Login" />
  </form>
</body>
</html>


config.php


Each nuBuilder site has it's own config.php. It supports the following configuration variables.

<?php
 
$DBHost                 = "127.0.0.1";
$DBName                 = "mysitedb";
$DBUser                 = "mysiteuser";
$DBPassword             = "mysitepass";
$DBGlobeadminPassword   = "mysiteglobeadmin";
 
?>


$DBHost


The MySQL server which hosts this site's database.

$DBName


The name of the database which this site uses.

$DBUser


Any MySQL user which has full permissions on the database specified by $DBName. By default, nuBuilder will not attempt to access any other database.

$DBPassword


The password for the MySQL user specified by $DBUser.

$DBGlobeadminPassword


An optional globeadmin password which is specific to this site. Either this password or the one specified in the global config.php can be used for logging in as globeadmin. This can be left blank to disable the site specific password.


database.php


nuBuilder expects this file to provide a function called nuRunQuery(). nuRunQuery() is used by nuBuilder for two functions: getting the details for connecting to the MySQL database and as a custom replacement for mysql_run_query(). Following is a template database.php.

<?php
 
require_once('config.php');
 
function nuRunQuery($pSQL, $pStopOnQueryError = true)
{
global $nuQueriesRun;
global $DBHost;
global $DBName;
global $DBUser;
global $DBPassword;
 
        $nuQueriesRun++;
 
        if($pSQL == '')
        {
                $a           = array();
                $a[0]        = $DBHost;
                $a[1]        = $DBName;
                $a[2]        = $DBUser;
                $a[3]        = $DBPassword;
                return $a;
        }
 
        $t = dbQuery($DBHost, $DBName, $DBUser, $DBPassword, $pSQL, $pStopOnQueryError);
        return $t;
}
 
?>




Created by: michael. Last Modification: Friday 22 of February, 2013 11:54:54 CST by steven.