A Block I am working on
Posted: 23. October 2008 13:13
A little guidance please.
i have created this in the portal/blocks folder called reviews.php
this to output the results in styles/portal/blocks
added the following to portal.php
included the file in the portal_body.html
The table shows on the portal but not the variables. What have i missed please?
i have created this in the portal/blocks folder called reviews.php
Code: Select all
// how many rows to show per page
$rowsPerPage = 2;
// by default we show first page
$pageNum = 1;
// if $_GET['page'] defined, use it as page number
if(isset($_GET['page']))
{
$pageNum = $_GET['page'];
}
// counting the offset
$offset = ($pageNum - 1) * $rowsPerPage;
$query = "SELECT * FROM phpbb_reviews LIMIT $offset, $rowsPerPage";
$result = mysql_query($query) or die('Error, query failed');
// print the results in a table
while($list = mysql_fetch_array($result))
{
$template->assign_block_vars('reviews_row', array(
'R_TITLE' => $list['title'],
'R_REVIEW' => $list['review'],
'R_INFO' => $list['info'],
'R_IMAGE' => $list['image'],
'R_LINK' => $list['link'],
'R_ED2K' => $list['ED2K']
)
);
}
Code: Select all
<!--version $Id: reviews.html 321 2008-08-17 10:17:11Z kevin74 $ //-->
<table width='100%' border='1'>
<tr>
<td colspan='3'>
<div align='center'>{reviews_row.R_TITLE}</div>
</tr>
<tr>
<td width='25%'> </td>
<td width='3%'> </td>
<td width='72%'>Review</td>
</tr>
<tr>
<td>{reviews_row.R_TITTLE}</td>
<td> </td>
<td>{reviews_row.R_REVIEW}</td>
</tr>
<tr>
<td> </td>
<td> </td>
<td> </td>
</tr>
<tr>
<td>
</td>
<td> </td>
<td>{reviews_row.R_INFO}</td>
</tr>
<tr>
<td> </td>
<td> </td>
<td> </td>
</tr>
<tr>
<td><a href="{reviews_row.R_LINK}">Board Link</a></td>
<td> </td>
<td><a href="{link.URL}" title="{link.TEXT}">{link.TEXT}</a></td>
<td>{R_ED2K}</td>
</tr>
</table>
Code: Select all
include($phpbb_root_path . 'portal/block/reviews.'.$phpEx);
The table shows on the portal but not the variables. What have i missed please?