OK. I'm just getting started with trying to build a fairly simple module that will send out an email invitation for events to a limited group of individuals that the user can specify.
My pnversion.php file looks like this:
$modversion['name'] = 'pnEvite';
$modversion['version'] = '1.00';
$modversion['description'] = 'Sends out an electronic invitation to an event';
$modversion['credits'] = 'pndocs/credits.txt';
$modversion['help'] = 'pndocs/help.txt';
$modversion['changelog'] = 'pndocs/changelog.txt';
$modversion['license'] = 'pndocs/license.txt';
$modversion['coding'] = 'pndocs/coding.txt';
$modversion['official'] = 0;
$modversion['author'] = 'David A. Pancost';
$modversion['contact'] = 'dave@strategicwebconcepts.com';
$modversion['admin'] = 1;
$modversion['securityschema'] = array();
I copied and modified what I found in the Template module's pninit.php (with the exception of the upgrade function). Here's what that looks like:
function pnEvite_init()
{
// Get datbase setup - note that both pnDBGetConn() and pnDBGetTables()
// return arrays but we handle them differently. For pnDBGetConn()
// we currently just want the first item, which is the official
// database handle. For pnDBGetTables() we want to keep the entire
// tables array together for easy reference later on
$dbconn =& pnDBGetConn(true);
$pntable =& pnDBGetTables();
// It's good practice to name the table and column definitions you
// are getting - $table and $column don't cut it in more complex
// modules
$pnEviteTable = $pntable['pnEvite'];
$pnEviteColumn =& pntable['pnEvite_column'];
// Create the table - the formatting here is not mandatory, but it does
// make the
SQL statement relatively easy to read. Also, separating out
// the
SQL statement from the Execute() command allows for simpler
// debug operation if it is ever needed
$
SQL = "CREATE TABLE $pnEviteTable (
$pnEviteColumn[EventDate] date,
$pnEviteColumn[EventMessage] text ,
PRIMARY KEY(pn_EventDate))";
$dbconn->Execute($
SQL);
// Check for an error with the database code, and if so set an
// appropriate error message and return
if ($dbconn->ErrorNo() != 0) {
return false;
}
function pnEvite_delete()
{
// Get datbase setup - note that both pnDBGetConn() and pnDBGetTables()
// return arrays but we handle them differently. For pnDBGetConn()
// we currently just want the first item, which is the official
// database handle. For pnDBGetTables() we want to keep the entire
// tables array together for easy reference later on
$dbconn =& pnDBGetConn(true);
$pntable =& pnDBGetTables();
// Drop the table - for such a simple command the advantages of separating
// out the
SQL statement from the Execute() command are minimal, but as
// this has been done elsewhere it makes sense to stick to a single method
$
SQL = "DROP TABLE $pntable[pnEvite]";
$dbconn->Execute($
SQL);
// Check for an error with the database code, and if so set an
// appropriate error message and return
if ($dbconn->ErrorNo() != 0) {
// Report failed deletion attempt
return false;
}
// Delete any module variables
pnModDelVar('pn_Evite', 'EDate');
pnModDelVar('pn_Evite', 'EMessage');
// Deletion successful
return true;
}
Now here's my question. When I regenerate my modules list, the pnEvite module shows up in my list and initialize is the first option under Actions. When, however, I click on Initialize, my browser goes blank and nothing happens. No database is created and my browser simply becomes a
BLANK SCREEN. Can somebody help me figure out what I've done wrong and get my Initialize function working? Or at least point me in the right direction to figure out what I can do to find out why things aren't working?
Thanks.