Is there an easy way of replacing the user_id to username in a view
that looks like this?
<div class="related">
<h3><?php echo __('Related Comments');?></h3>
<?php if (!empty($post['Comment'])):?>
<table cellpadding = "0" cellspacing = "0">
<tr>
<th><?php echo __('Id'); ?></th>
<th><?php echo __('Title'); ?></th>
<th><?php echo __('Content'); ?></th>
<th><?php echo __('Username'); ?></th>
<th class="actions"><?php echo __('Actions');?></th>
</tr>
<?php
$i = 0;
foreach ($post['Comment'] as $comment): ?>
<tr>
<td><?php echo $comment['id'];?></td>
<td><?php echo $comment['title'];?></td>
<td><?php echo $comment['content'];?></td>
<td><?php echo $comment['user_id']; ?></td> <------- I
want to
change this into the users username
<td class="actions">
<?php echo $this->Html->link(__('View'),
array('controller' =>
'comments', 'action' => 'view', $comment['id'])); ?>
<?php echo $this->Html->link(__('Edit'),
array('controller' =>
'comments', 'action' => 'edit', $comment['id'])); ?>
<?php echo $this->Form->postLink(__('Delete'),
array('controller'
=> 'comments', 'action' => 'delete', $comment['id']), null, __('Are
you sure you want to delete # %s?', $comment['id'])); ?>
</td>
</tr>
<?php endforeach; ?>
</table>
<?php endif; ?>
</div>
--
Our newest site for the community: CakePHP Video Tutorials
http://tv.cakephp.org
Check out the new CakePHP Questions site http://ask.cakephp.org and help others
with their CakePHP related questions.
To unsubscribe from this group, send email to
[email protected] For more options, visit this group at
http://groups.google.com/group/cake-php