你的模型
type'=>'left', 'conditions' => array('Class_master.class_id = Student_master.student_class'), 'dependent' => true ) ); } ?>
控制器:
$this->paginate = array('limit' => 25,'order' => array('admin_id' => 'asc'), 'conditions'=>array('school_admin_id'=>$this->Session- >read('Auth.User.school_admin_id')));
$stlist = $this->paginate('Student_master');
$this->set('stlist',$stlist);
$this->set('students_data',$stlist);
看法:
<tr>
<th><input type="checkbox" name="checkall" id="checkall" onclick='checkedAll();'></th>
<th>Name</th>
<th>Email ID</th>
<th>Contact No</th>
<th>Class</th>
<th>Status</th>
<th>Option</th>
</tr>
<?php
$rowcount=0;
foreach ($students_data as $st_data) {
$student_status=$st_data['Student_master']['student_status'];
$student_id=$st_data['Student_master']['student_id'];
$rowcount++;
if($rowcount%2==0){
$class='evenrow';
}else{
$class='oddrow';
}
?>
<tr class='<?php echo $class;?>'>
<td>
<?php echo $this->Form->input("checkbox_std.", array("type" => "checkbox","value"=>$student_id));?>
</td>
<td><?php echo $st_data['Student_master']['student_name'];?></td>
<td><?php echo $st_data['Student_master']['student_email'];?></td>
<td><?php echo $st_data['Student_master']['student_contact'];?></td>
<td><?php echo $st_data['Class_master']['class_name'];?></td>
<td>
<?php
if($student_status==0){
?>
<input type='button' value='Activate'>
<?php }else{ ?>
<input type='button' value='De-Activate'>
<?php } ?>
</td>
<td>
<input type='button' value='Edit'>
<input type='button' value='View'>
<input type='button' value='Delete'>
</td>
</tr>