Davey
08-14-2004, 09:16 AM
Table coming up blank. Everything else was peachy.
I kind of troubleshot it down to roughly where it is, seems my fetch_template() calls aren't doing their job properly.
Called from DB, if my query wasn't successful, surely it'd have fetched the error template (no num_rows)
Anyway... the stuff.
File: guild.php
Incompleted.
<?php
error_reporting(E_ALL & ~E_NOTICE);
define('NO_REGISTER_GLOBALS', 1);
define('THIS_SCRIPT', 'guild');
// precache templates used by all actions
$globaltemplates = array(
'members',
'treasury'
);
// precache templates used by specific actions
$actiontemplates = array(
'members' => array(
'guild_memberrow',
'guild_memberslist'
),
);
if (empty($_REQUEST['do']))
{
$_REQUEST['do'] = 'members';
}
require_once("./global.php");
if ($_REQUEST['do'] == 'members')
{
// build the query
$memberlistquery = $DB_site->query("
SELECT *
FROM " . TABLE_PREFIX . "user
WHERE '8' IN (membergroupids)
ORDER BY username ASC
") or die("mysql error");
$endtemplate = '';
// check if there are any members from this group
if ($DB_site->num_rows($memberlistquery) == '0')
{
eval('$endtemplate = "' . fetch_template('guild_error_nomembers') . '";');
}
// start getting the users
while ($memberlist = $DB_site->fetch_array($memberlistquery))
{
eval('$endtemplate .= "' . fetch_template('guild_memberrow') . '";');
}
// done
$templatename = 'guild_memberslist';
}
$navbits = array();
$navbits[$parent] = 'Guild Members';
$navbits = construct_navbits($navbits);
eval('$navbar = "' . fetch_template('navbar') . '";');
eval('print_output("' . fetch_template($templatename) . '");');
?>
Template: guild_memberslist
$stylevar[htmldoctype]
<html dir="$stylevar[textdirection]" lang="$stylevar[languagecode]">
<head>
<title>$vboptions[bbtitle]</title>
$headinclude
</head>
<body>
$header
$navbar
<table class="tborder" cellpadding="$stylevar[cellpadding]" cellspacing="$stylevar[cellspacing]" border="0" width="100%" align="center">
<tr>
<td class="tcat" colspan="6" style="text-align: center; vertical-align: middle">
<strong>$vbphrase[guild_memberlist]</strong>
</td>
</tr>
<tr>
<td class="tcat" colspan="1" style="text-align: center; vertical-align: middle">
<strong>$vbphrase[guild_desc_username]</strong>
</td>
<td class="tcat" colspan="1" style="text-align: center; vertical-align: middle">
<strong>$vbphrase[guild_desc_rank]</strong>
</td>
<td class="tcat" colspan="1" style="text-align: center; vertical-align: middle">
<strong>$vbphrase[guild_desc_class]</strong>
</td>
<td class="tcat" colspan="1" style="text-align: center; vertical-align: middle">
<strong>$vbphrase[guild_desc_profession]</strong>
</td>
</tr>
$endtemplate
<tr>
<td class="tcat" colspan="7" style="text-align: center; vertical-align: middle">
<strong>$vbphrase[guild_memberlist]</strong>
</td>
</tr>
</table>
</td>
</tr>
</table>
</td>
</tr>
</table>
$footer
</body>
</html>
Template: guild_memberrow
<tr>
<td style="text-align: center; vertical-align: middle">
<a href="member.php?u=$memberlist[userid]">$memberlist[musername]</a>
</td>
<td style="text-align: center; vertical-align: middle">
<if condition="$memberlist[field5]">
$memberlist[field5]
</if>
<if condition="!$memberlist[field5]">
Undisclosed.
</if>
</td>
<td style="text-align: center; vertical-align: middle">
<if condition="$memberlist[field6]">
$memberlist[field6]
</if>
<if condition="!$memberlist[field6]">
Undisclosed.
</if>
</td>
<td style="text-align: center; vertical-align: middle">
<if condition="$memberlist[field7]">
$memberlist[field7]
</if>
<if condition="!$memberlist[field7]">
Undisclosed.
</if>
</td>
</tr>
Template: guild_error_nomembers
<tr><td>There are no members in this group.</td></tr>
String: guild.php?do=members
Outcome: See attachment screenshot.
I kind of troubleshot it down to roughly where it is, seems my fetch_template() calls aren't doing their job properly.
Called from DB, if my query wasn't successful, surely it'd have fetched the error template (no num_rows)
Anyway... the stuff.
File: guild.php
Incompleted.
<?php
error_reporting(E_ALL & ~E_NOTICE);
define('NO_REGISTER_GLOBALS', 1);
define('THIS_SCRIPT', 'guild');
// precache templates used by all actions
$globaltemplates = array(
'members',
'treasury'
);
// precache templates used by specific actions
$actiontemplates = array(
'members' => array(
'guild_memberrow',
'guild_memberslist'
),
);
if (empty($_REQUEST['do']))
{
$_REQUEST['do'] = 'members';
}
require_once("./global.php");
if ($_REQUEST['do'] == 'members')
{
// build the query
$memberlistquery = $DB_site->query("
SELECT *
FROM " . TABLE_PREFIX . "user
WHERE '8' IN (membergroupids)
ORDER BY username ASC
") or die("mysql error");
$endtemplate = '';
// check if there are any members from this group
if ($DB_site->num_rows($memberlistquery) == '0')
{
eval('$endtemplate = "' . fetch_template('guild_error_nomembers') . '";');
}
// start getting the users
while ($memberlist = $DB_site->fetch_array($memberlistquery))
{
eval('$endtemplate .= "' . fetch_template('guild_memberrow') . '";');
}
// done
$templatename = 'guild_memberslist';
}
$navbits = array();
$navbits[$parent] = 'Guild Members';
$navbits = construct_navbits($navbits);
eval('$navbar = "' . fetch_template('navbar') . '";');
eval('print_output("' . fetch_template($templatename) . '");');
?>
Template: guild_memberslist
$stylevar[htmldoctype]
<html dir="$stylevar[textdirection]" lang="$stylevar[languagecode]">
<head>
<title>$vboptions[bbtitle]</title>
$headinclude
</head>
<body>
$header
$navbar
<table class="tborder" cellpadding="$stylevar[cellpadding]" cellspacing="$stylevar[cellspacing]" border="0" width="100%" align="center">
<tr>
<td class="tcat" colspan="6" style="text-align: center; vertical-align: middle">
<strong>$vbphrase[guild_memberlist]</strong>
</td>
</tr>
<tr>
<td class="tcat" colspan="1" style="text-align: center; vertical-align: middle">
<strong>$vbphrase[guild_desc_username]</strong>
</td>
<td class="tcat" colspan="1" style="text-align: center; vertical-align: middle">
<strong>$vbphrase[guild_desc_rank]</strong>
</td>
<td class="tcat" colspan="1" style="text-align: center; vertical-align: middle">
<strong>$vbphrase[guild_desc_class]</strong>
</td>
<td class="tcat" colspan="1" style="text-align: center; vertical-align: middle">
<strong>$vbphrase[guild_desc_profession]</strong>
</td>
</tr>
$endtemplate
<tr>
<td class="tcat" colspan="7" style="text-align: center; vertical-align: middle">
<strong>$vbphrase[guild_memberlist]</strong>
</td>
</tr>
</table>
</td>
</tr>
</table>
</td>
</tr>
</table>
$footer
</body>
</html>
Template: guild_memberrow
<tr>
<td style="text-align: center; vertical-align: middle">
<a href="member.php?u=$memberlist[userid]">$memberlist[musername]</a>
</td>
<td style="text-align: center; vertical-align: middle">
<if condition="$memberlist[field5]">
$memberlist[field5]
</if>
<if condition="!$memberlist[field5]">
Undisclosed.
</if>
</td>
<td style="text-align: center; vertical-align: middle">
<if condition="$memberlist[field6]">
$memberlist[field6]
</if>
<if condition="!$memberlist[field6]">
Undisclosed.
</if>
</td>
<td style="text-align: center; vertical-align: middle">
<if condition="$memberlist[field7]">
$memberlist[field7]
</if>
<if condition="!$memberlist[field7]">
Undisclosed.
</if>
</td>
</tr>
Template: guild_error_nomembers
<tr><td>There are no members in this group.</td></tr>
String: guild.php?do=members
Outcome: See attachment screenshot.