diff options
Diffstat (limited to 'poc/poc02-compiling-cake/src/workdir/in/app/View/Posts')
4 files changed, 54 insertions, 0 deletions
diff --git a/poc/poc02-compiling-cake/src/workdir/in/app/View/Posts/add.ctp b/poc/poc02-compiling-cake/src/workdir/in/app/View/Posts/add.ctp new file mode 100644 index 0000000..c36d35e --- /dev/null +++ b/poc/poc02-compiling-cake/src/workdir/in/app/View/Posts/add.ctp @@ -0,0 +1,7 @@ +<h1>Add Post</h1> +<?php +echo $this->Form->create('Post'); +echo $this->Form->input('title'); +echo $this->Form->input('body', array('rows' => '3')); +echo $this->Form->end('Save Post'); +?> diff --git a/poc/poc02-compiling-cake/src/workdir/in/app/View/Posts/edit.ctp b/poc/poc02-compiling-cake/src/workdir/in/app/View/Posts/edit.ctp new file mode 100644 index 0000000..221d85a --- /dev/null +++ b/poc/poc02-compiling-cake/src/workdir/in/app/View/Posts/edit.ctp @@ -0,0 +1,8 @@ +<h1>Edit Post</h1> +<?php + echo $this->Form->create('Post', array('action' => 'edit')); + echo $this->Form->input('title'); + echo $this->Form->input('body', array('rows' => '3')); + echo $this->Form->input('id', array('type' => 'hidden')); + echo $this->Form->end('Save Post'); +?> diff --git a/poc/poc02-compiling-cake/src/workdir/in/app/View/Posts/index.ctp b/poc/poc02-compiling-cake/src/workdir/in/app/View/Posts/index.ctp new file mode 100644 index 0000000..754b378 --- /dev/null +++ b/poc/poc02-compiling-cake/src/workdir/in/app/View/Posts/index.ctp @@ -0,0 +1,33 @@ +<h1>Blog posts</h1> +<p><?php echo $this->Html->link('Add Post', array('action' => 'add')); ?></p> +<table> + <tr> + <th>Id</th> + <th>Title</th> + <th>Actions</th> + <th>Created</th> + </tr> + +<!-- Here's where we loop through our $posts array, printing out post info --> + + <?php foreach ($posts as $post): ?> + <tr> + <td><?php echo $post['Post']['id']; ?></td> + <td> + <?php echo $this->Html->link($post['Post']['title'], array('action' => 'view', $post['Post']['id'])); ?> + </td> + <td> + <?php echo $this->Form->postLink( + 'Delete', + array('action' => 'delete', $post['Post']['id']), + array('confirm' => 'Are you sure?')); + ?> + <?php echo $this->Html->link('Edit', array('action' => 'edit', $post['Post']['id'])); ?> + </td> + <td> + <?php echo $post['Post']['created']; ?> + </td> + </tr> + <?php endforeach; ?> + +</table> diff --git a/poc/poc02-compiling-cake/src/workdir/in/app/View/Posts/view.ctp b/poc/poc02-compiling-cake/src/workdir/in/app/View/Posts/view.ctp new file mode 100644 index 0000000..4fb6556 --- /dev/null +++ b/poc/poc02-compiling-cake/src/workdir/in/app/View/Posts/view.ctp @@ -0,0 +1,6 @@ +<h1><?php echo h($post['Post']['title']); ?></h1> + +<p><small>Created: <?php echo $post['Post']['created']; ?></small></p> + +<p><?php echo h($post['Post']['body']); ?></p> + |