diff options
author | Ludovic Pouzenc <ludovic@pouzenc.fr> | 2012-08-02 12:12:19 +0000 |
---|---|---|
committer | Ludovic Pouzenc <ludovic@pouzenc.fr> | 2012-08-02 12:12:19 +0000 |
commit | e62dfb1a310aff5efa285e8bde018314e6f70b50 (patch) | |
tree | 48ef6707c44ec8a4f8307bec0dc30b0ef589d023 /poc/poc02-compiling-cake/src/workdir/in/app/View/Posts | |
parent | 16cb6f4e2c7820f8e5d31c23d3497c459041bb6d (diff) | |
download | 2012-php-weave-e62dfb1a310aff5efa285e8bde018314e6f70b50.tar.gz 2012-php-weave-e62dfb1a310aff5efa285e8bde018314e6f70b50.tar.bz2 2012-php-weave-e62dfb1a310aff5efa285e8bde018314e6f70b50.zip |
Application Blog fonctionnelle avec repertoire du framework separé et mod-rewrite utilisé (donc le index.php à la racine ne sert pas, c'est le app/webroot/index.php qui sert)
git-svn-id: file:///var/svn/2012-php-weave/trunk@9 d972a294-176a-4cf9-8ea1-fcd5b0c30f5c
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> + |