Skip to content

Instantly share code, notes, and snippets.

@slywalker
Created March 6, 2010 07:12
Show Gist options
  • Save slywalker/323565 to your computer and use it in GitHub Desktop.
Save slywalker/323565 to your computer and use it in GitHub Desktop.
<div class="users view">
<h2><?php __('User');?></h2>
<dl><?php $i = 0; $class = ' class="altrow"';?>
<dt<?php if ($i % 2 == 0) echo $class;?>><?php __('Id'); ?></dt>
<dd<?php if ($i++ % 2 == 0) echo $class;?>>
<?php echo $user['User']['id']; ?>
&nbsp;
</dd>
<dt<?php if ($i % 2 == 0) echo $class;?>><?php __('Username'); ?></dt>
<dd<?php if ($i++ % 2 == 0) echo $class;?>>
<?php echo $user['User']['username']; ?>
&nbsp;
</dd>
<dt<?php if ($i % 2 == 0) echo $class;?>><?php __('Password'); ?></dt>
<dd<?php if ($i++ % 2 == 0) echo $class;?>>
<?php echo $user['User']['password']; ?>
&nbsp;
</dd>
<dt<?php if ($i % 2 == 0) echo $class;?>><?php __('Created'); ?></dt>
<dd<?php if ($i++ % 2 == 0) echo $class;?>>
<?php echo $user['User']['created']; ?>
&nbsp;
</dd>
</dl>
</div>
<div class="actions">
<ul>
<li><?php echo $html->link(__('Edit User', true), array('action' => 'edit', $user['User']['id'])); ?> </li>
<li><?php echo $html->link(__('Delete User', true), array('action' => 'delete', $user['User']['id']), null, sprintf(__('Are you sure you want to delete # %s?', true), $user['User']['id'])); ?> </li>
<li><?php echo $html->link(__('List Users', true), array('action' => 'index')); ?> </li>
<li><?php echo $html->link(__('New User', true), array('action' => 'add')); ?> </li>
<li><?php echo $html->link(__('List Posts', true), array('controller' => 'posts', 'action' => 'index')); ?> </li>
<li><?php echo $html->link(__('New Post', true), array('controller' => 'posts', 'action' => 'add')); ?> </li>
</ul>
</div>
<div class="related">
<h3><?php __('Related Posts');?></h3>
<?php if (!empty($user['Post'])):?>
<table cellpadding = "0" cellspacing = "0">
<tr>
<th><?php __('Id'); ?></th>
<th><?php __('User Id'); ?></th>
<th><?php __('Title'); ?></th>
<th><?php __('Body'); ?></th>
<th><?php __('Created'); ?></th>
<th><?php __('Modified'); ?></th>
<th class="actions"><?php __('Actions');?></th>
</tr>
<?php
$i = 0;
foreach ($user['Post'] as $post):
$class = null;
if ($i++ % 2 == 0) {
$class = ' class="altrow"';
}
?>
<tr<?php echo $class;?>>
<td><?php echo $post['id'];?></td>
<td><?php echo $post['user_id'];?></td>
<td><?php echo $post['title'];?></td>
<td><?php echo $post['body'];?></td>
<td><?php echo $post['created'];?></td>
<td><?php echo $post['modified'];?></td>
<td class="actions">
<?php echo $html->link(__('View', true), array('controller' => 'posts', 'action' => 'view', $post['id'])); ?>
<?php echo $html->link(__('Edit', true), array('controller' => 'posts', 'action' => 'edit', $post['id'])); ?>
<?php echo $html->link(__('Delete', true), array('controller' => 'posts', 'action' => 'delete', $post['id']), null, sprintf(__('Are you sure you want to delete # %s?', true), $post['id'])); ?>
</td>
</tr>
<?php endforeach; ?>
</table>
<?php endif; ?>
<div class="actions">
<ul>
<li><?php echo $html->link(__('New Post', true), array('controller' => 'posts', 'action' => 'add'));?> </li>
</ul>
</div>
</div>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment