Mellow1234
Member
Requirement:
Here's my Page Node HTML and I know the foreach has to be wrong:
Getting Callback Mileage\Mileage::getMileage is invalid (error_invalid_class).
1 - What's the benefit of putting the class/method in the html block vs the page parms? Do you just get a faster verification when it has issues?
2 - Is my sql correct
3 - what should the foreach examine given that sql? would it be $fetchAll?
Thanks any help is appreciated... I think I'm kinda close just missing something.
Join
xf_user_field_value and xf_user by user_id
and only for
xf_user_field_value.field_id = 'miles' and
xf_user_field_value.field_value > spaces
order xf_user_field_value.field_value DESC
Here's my code in (/src/addons/Mileage/Mileage.php) and this is my ONLY file:
PHP:
<?php
namespace Mileage\Mileage;
class Mileage{
public function getMileage()
{
return $this->_getDb()->fetchAll("
SELECT *
FROM `xf_user_field_value`
INNER JOIN `xf_user` ON `xf_user_field_value`.`user_id` = `xf_user`.`user_id`
WHERE 'field_id` = 'miles' and 'field_value' > ' '
ORDER BY `field_value` DESC
");
}
}
Here's my Page Node HTML and I know the foreach has to be wrong:
HTML:
<xf:callback class="Mileage\Mileage" method="getMileage"></xf:callback>
<table id="Mileage" width="100%" border="1">
<th>Rank</th><th>Name</th><th>Mileage</th><th>Miles Per Day</th><th>Projected Year End</th><th>Country</th> <th>State/Province</th><th>Bike</th>
<xf:foreach loop="$getMileage" value="$getMileage">
<tr>
<td>-</td> <td>-</td><td align='center'>-</td> <td align='center'>-</td><td align='center'>-</td> <td align='center'>-</td><td align='center'>-</td> <td align='center'>-</td>
<tr>
</xf:foreach>
</table>
Getting Callback Mileage\Mileage::getMileage is invalid (error_invalid_class).
1 - What's the benefit of putting the class/method in the html block vs the page parms? Do you just get a faster verification when it has issues?
2 - Is my sql correct
3 - what should the foreach examine given that sql? would it be $fetchAll?
Thanks any help is appreciated... I think I'm kinda close just missing something.
Last edited: