Jump to content

Problem using phpBB templates


Curator

Recommended Posts

I inherited an application that was designed using the phpBB template engine.  I am trying to make modifications, and enhancments.

 

The application is a testing system where course directors can create questions and assemble these questions into a test for their students.  What I am trying to do is make a report feature, where one of the secretaries can bring up a page and select a course and author (createdby) by using list boxes.  These values are passed to a viewquestions page where all questions will be displayed for that course and that author, along with statistics.

 

The server is on campus where I work at the university and behind a firewall.  I dumped the pages on another host.

 

My main index page has a link to send me to reports.

 

http://www.donovanfamily.us/flight/index.txt

 

the template that goes with this

 

http://www.donovanfamily.us/flight/index_body.txt

 

Where I can bring up the popup to select the courses and createdby (author of the questions)

 

http://www.donovanfamily.us/flight/getinfo.txt

 

and its template

 

http://www.donovanfamily.us/flight/getinfo_body.txt

 

Which sends me to the page to view all the questions from the course selected by author.

 

http://www.donovanfamily.us/flight/viewquestions.txt

 

and its template

 

http://www.donovanfamily.us/flight/viewquestions_body.txt

 

I think my issue resides with the assign_block_vars not working as intended.

 

I can manually assign values

 

$media = $question['stem'];

 

then echo these out but am unable to pass these using the

 

assign_block_vars so they appear in the template.

 

This phpBB template engine is difficult for me to understand but that is what the previous developer used so I would rather stick with it.

 

There are over 4000 questions from probably 100 authors in the database.

 

Right now all I get is the template with no data displaying.  As always thanks for any assistance.

Link to comment
Share on other sites

Anybody have any ideas here?  I could really use some help.  Once I get something displaying properly I will be off and running, but so far nothing displays in the viewquestions except for the empty template.

 

I know for a fact my sql query works as I've tested it a dozen times.

Link to comment
Share on other sites

Getting kinda desperate before I pitch this whole template thing and code it all in one big page.  I know I'm close but can't find my error.

 

Here is a quick synopsis.

 

First I get my variables passed from the popup and create a  resultset.  I have tested this and am passing correct variables for course_id and user_id.

 

$mode = ( isset($HTTP_GET_VARS['action']) ) ? ($HTTP_GET_VARS['action']) : ( ( isset($HTTP_POST_VARS['action']) ) ? ($HTTP_POST_VARS['action']) : '') ;
$course_id =  ( isset($HTTP_GET_VARS['course_id']) ) ? ($HTTP_GET_VARS['course_id']) : ( ( isset($HTTP_POST_VARS['course_id']) ) ? ($HTTP_POST_VARS['course_id']) : 0) ;
$user_id =  ( isset($HTTP_GET_VARS['user_id']) ) ? ($HTTP_GET_VARS['user_id']) : ( ( isset($HTTP_POST_VARS['user_id']) ) ? ($HTTP_POST_VARS['user_id']) : 0) ;

if((  $userdata['session_logged_in'] ) && (  $userdata['user_level'] == ADMIN ) ){	

	include($somCBT_root_path . 'includes/page_header.php');

	$template->set_filenames(array(
		'body' => 'reports/viewquestions_body.tpl')
	);	

	$nav_path = '<a href="'.append_sid($somCBT_root_path.'index.php').'" class="nav">'.Home.'';

	//Start 

	$result = $db->sql_query('SELECT * FROM '. QUESTIONS_TABLE. ' q, '. COURSE_TABLE .' c WHERE  c.course_id = ' .$course_id.' AND q.createdby = '.$user_id.'') ;
					if (!$result) {
					echo("<p>Error performing query: " . mysql_error() . "</p>");
					exit();   
					}					

			while ($question = $db->sql_fetchrow($result)) {

 

My sql query is working as I've tested it a dozen times.

 

Then use the phpBB engine to assign variables. 

 

$template->assign_block_vars('question',array(
										'qid' => $question['question_id'],
										'NAME' => $question['ques_name'],
										'STEM' => nl2br($question['stem'])."<br>",
										'MEDIA' => $media."<br>",
										'FEED' => $question['feedback']."<br>"));

}			// end of while resultset


 

Then redirect if they are not an admin and generate the page.

 

} else {
redirect(append_sid("login.php", true));
}
//
// Generate the page
//

$template->pparse('overall_header');

$template->pparse('body');

include($somCBT_root_path . 'includes/page_tail.php');

 

My template is coming up empty with no data.  I manually run the query in phpMyadmin and have 100's of records with course_id = 1 and createdby = 988.  I know my query is correct.

 

Here is the template.  I want to get question working before I work on stats.

 

 

<table width="100%" cellpadding="0" cellspacing="0" border="1"  class="bodyline">
<tr>
	<td  height="140" valign="top">
		<table width="100%" cellpadding="0" cellspacing="0" border="0">
<!-- BEGIN user --> 
		<tr>
			<td>                 
                
				<table width="100%" cellpadding="0" cellspacing="0" border="0" class="borderline" align="center">
<tr> 
   <td align="left" valign="top">
<table width="100%" cellpadding="0" cellspacing="0" border="0"  class="bodyline">
<tr>
	<td  height="240" valign="top">
<!-- BEGIN question -->
		<table cellpadding="3" cellspacing="0" border="0" width="98%" align="center">
		<tr>
			<td width="20"> </td>
			<td>{question.NAME}</td>
		</tr>
		<tr><td colspan="2" class="gen">{question.STEM}<p></p>{question.MEDIA}</td></tr>
<!-- BEGIN options -->
		<tr>
			<td class="gen" align="center">{question.options.OPTION_ID}</td>
			<td class="gen">{question.options.ATTRIBUTES}</td>
		</tr>
<!-- END options -->
		</table>
<table width="100%" cellpadding="3" cellspacing="0" border="0"  class="bodyline">
		<tr>
			<td align="left"> </td>
			<td align="left"> </td>
		</tr>
		<tr><td class="gen">Feedback:<br><br>{question.FEED}</td></tr>
		</table>			
<!-- END question -->		
	</td>
</tr>

</table>
  </td>
</tr>

</table>
</td></tr>
</table>
			</td>
		</tr>
<!-- END user -->	
		<tr>
			<td height="12"></td>
		</tr>
		</table>
	</td>
</tr>
</table>
  </td>
</tr>

<tr><td height="12" colspan="2"></td></tr>
<table width="100%" cellpadding="0" cellspacing="0" border="0" class="borderline" align="center">
<tr> 
   <td align="left" valign="top">
<table width="100%" cellpadding="0" cellspacing="0" border="0"  class="bodyline">
<tr>
	<td  height="240" valign="top">
		<table cellpadding="3" cellspacing="0" border="0" width="99%" align="center">
		<tr><td colspan="11" height="10"></td>
		<tr>
			<th rowspan="2" width="30" class="helptext" valign="middle">Quiz ID#</th>
			<th rowspan="2" width="30" class="helptext" valign="middle">Year Used</th>
			<th ALIGN="center" ROWSPAN=2 width=35 class="helptext" valign="middle">N</th>
			<th COLSPAN=3 valign=top class="helptext" width="305">% Correct Of:</th>
			<th VALIGN="middle" ROWSPAN=2 class="helptext" width=40>Discrimination</th>
			<th VALIGN="middle" ROWSPAN=2 class="helptext" width=40>Correct Answer:</th>
			<th COLSPAN=7 class="helptext">Frequency</th>
		</tr>
		<tr>
			<th align="center" valign="middle" class="helptext" width=50>Whole Group</th>
			<th align="center" valign="middle" class="helptext" width=50>Upper 25%</th>
			<th align="center" valign="middle" class="helptext" width=50>Lower 25%</th>
			<th width=30 class="helptext">A</th>
			<th width=30 class="helptext">B</th>
			<th width=30 class="helptext">C</th>
			<th width=30 class="helptext">D</th>
			<th width=30 class="helptext">E</th>
		</tr> 

<!-- BEGIN stats -->
		<tr>
			<td class="genmed" align="center" height="30" nowrap>{stats.QZ_NAME}</td>
			<td class="genmed" align="center" height="30" nowrap>{stats.YEAR}</td>
			<td class="genmed" align="center"> {stats.N} </td>
			<td class="genmed" align="center"> {stats.WHOLE} </td>
			<td class="genmed" align="center"> {stats.U25} </td>
			<td class="genmed" align="center"> {stats.L25} </td>
			<td class="genmed" align="center"> {stats.DISCRI} </td>
			<td class="genmed" align="center"> {stats.CRCT} </td>
			<td class="genmed" align="center"> {stats.F1} </td>
			<td class="genmed" align="center"> {stats.F2} </td>
			<td class="genmed" align="center"> {stats.F3} </td>
			<td class="genmed" align="center"> {stats.F4} </td>
			<td class="genmed" align="center"> {stats.F5} </td>
		</tr>

<!-- END stats -->
		</table>
	</td>
</tr>

</table>
  </td>
</tr>

</table>
</td></tr>
<tr><td>

<table width="100%" cellpadding="0" cellspacing="0" border="0" class="borderline" align="left">
<tr>
   <td align="left" class="helptext">Historical Statistics from WebCT</td>
</tr>
<tr> 
   <td align="left" valign="top">
<table width="100%" cellpadding="0" cellspacing="0" border="0"  class="bodyline">
<tr>
	<td  height="240" valign="top">
		<table cellpadding="3" cellspacing="0" border="0" width="99%" align="center">
		<tr><td colspan="11" height="10"></td>
		<tr>
			<th rowspan="2" width="10" class="helptext" valign="middle">Quiz ID#</th>
			<th rowspan="2" width="10" class="helptext" valign="middle">Year Used</th>
			<th ALIGN="center" ROWSPAN=2 width=35 class="helptext" valign="middle">N</th>
			<th COLSPAN=3 valign=top class="helptext" width="305">% Correct Of:</th>
			<th VALIGN="middle" ROWSPAN=2 class="helptext" width=40>Discrimination</th>
			<th VALIGN="middle" ROWSPAN=2 class="helptext" width=40>Correct Answer:</th>
			<th COLSPAN=7 class="helptext">Frequency</th>
		</tr>
		<tr>
			<th align="center" valign="middle" class="helptext" width=50>Whole Group</th>
			<th align="center" valign="middle" class="helptext" width=50>Upper 25%</th>
			<th align="center" valign="middle" class="helptext" width=50>Lower 25%</th>
			<th width=30 class="helptext">A</th>
			<th width=30 class="helptext">B</th>
			<th width=30 class="helptext">C</th>
			<th width=30 class="helptext">D</th>
			<th width=30 class="helptext">E</th>
		</tr> 

<!-- BEGIN stats -->
		<tr>
			<td class="genmed" align="center" height="30" width="15">{stats.QZ_NAME2}</td>
			<td class="nav" align="center" height="30" width="15">{stats.YEAR2}</td>
			<td class="genmed" align="center"> {stats.N2} </td>
			<td class="genmed" align="center"> {stats.WHOLE2} </td>
			<td class="genmed" align="center"> {stats.U252} </td>
			<td class="genmed" align="center"> {stats.L252} </td>
			<td class="genmed" align="center" width="20"> {stats.DISCRI2} </td>
			<td class="genmed" align="center"> {stats.CRCT2} </td>
			<td class="genmed" align="center" width="5"> {stats.F12} </td>
			<td class="genmed" align="center" width="5"> {stats.F22} </td>
			<td class="genmed" align="center" width="5"> {stats.F32} </td>
			<td class="genmed" align="center" width="5"> {stats.F42} </td>
			<td class="genmed" align="center" width="5"> {stats.F52} </td>
		</tr>
<!-- END stats -->
		</table>
	</td>
</tr>

</table>

</table>

<br>

 

 

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.