I know parse error and such things are programmers 101, but I cant find whats wrong with the file and the error "syntax error, unexpected end of file"
Following the tutorial helps me a lot getting to know php and Yii, but maybe the error isnt in that file, maybe somewere els. Hoppyfully you can help me with that.
<?php
$this->pageTitle=Yii::app()->name . ' - Add User To Domain';
$this->breadcrumbs=array(
$model->domain->name=>array('view','id'=>$model->domain->id),
'Add User',
);
$this->menu=array(
array('label'=>'Back To Domain', 'url'=>array('view','id'=>$model->domain->id)),
);?>
<h1>Add User To <?php echo $model->domain->name; ?></h1>
<?php if(Yii::app()->user->hasFlash('success')):?>
<div class="successMessage">
<?php echo Yii::app()->user->getFlash('success'); ?>
</div>
<?phpendif; ?>
<div class="form">
<?php $form=$this->beginWidget('CActiveForm'); ?>
<p class="note">Fields with <span class="required">*</span> are required.</p>
<div class="row">
<?php echo $form->labelEx($model,'username'); ?>
<?php $this->widget('CAutoComplete', array(
'model'=>$model,
'attribute'=>'username',
'data'=>$usernames,
'multiple'=>false,
'htmlOptions'=>array('size'=>25),
)); ?>
<?php echo $form->error($model,'username'); ?>
</div>
<div class="row">
<?php echo $form->labelEx($model,'role'); ?>
<?php echo $form->dropDownList($model,'role', Project::getUserRoleOptions()); ?>
<?php echo $form->error($model,'role'); ?>
</div>
<div class="row buttons">
<?php echo CHtml::submitButton('Add User'); ?>
</div>
<?php $this->endWidget(); ?>
//Error found thank you tinyByte
Another question:
Yii tells me that 'data'=>$usernames,
is an Undefined variable: usernames
But in my UserForm Class php File I have this:
public function createUsernameList()
{
$sql = "SELECT username FROM tbl_user";
$command = Yii::app()->db->createCommand($sql);
$rows = $command->queryAll();
//format it for use with auto complete widget
$usernames = array();
foreach($rows as $row)
{
$usernames[]=$row['username'];
}
return $usernames;
}
Do I have to create a public $usernames or something?