I'm getting the following error in a Joomla model file:
unexpected T_VARIABLE, expecting T_FUNCTION in /var/www/html/clientFiles/components/com_arrcard/models/buynow.php on line 13
Here's the beginning of the file, up through line 14:
<?php
defi开发者_开发技巧ned( '_JEXEC' ) or die( 'Restricted access' );
jimport('joomla.application.component.model');
class ArrcardModelBuynow extends JModel
{
public $failedFields = array();
public $certificateNumber, $emailAddr, $voucherID, $voucherNbr, $userAcctID;
//check if user is logged in
$user =& JFactory::getUser();
$userAcctID = $user->id;
Does anyone know why the getUser line is causing problems? I've used that code in a number of other places with no errors.
As the error says, this code:
//check if user is logged in
$user =& JFactory::getUser();
$userAcctID = $user->id;
must be inside a function. Directly in the class, you can only declare member variables. $user
doesn't even seem to be defined somewhere.
精彩评论