Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add the 'add' method in PostController.
Create the add view and store the codes in app/view/posts/add.ctp file Create the add_or_edit.ctp file in app/view/elements/
- Loading branch information
1 parent
a9df142
commit 69bbaeb
Showing
4 changed files
with
74 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
<fieldset> | ||
<legend> | ||
<?php | ||
__('Add a Post!'); | ||
?> | ||
</legend> | ||
Please fill in all fields. | ||
<?php | ||
echo $this->Form->create('Post'); | ||
echo $this->Form->error('Post.title'); | ||
echo $this->Form->input('Post.title', | ||
array('id'=>'postitle', | ||
'label'=>'Title:', | ||
'size'=> 50, | ||
'maxlength'=>255, | ||
'error'=>false)); | ||
echo $this->Form->error('Post.content'); | ||
echo $this->Form->input('Post.content', | ||
array('id'=>'postcontent', | ||
'type'=>'textarea', | ||
'label'=>'Content', | ||
'rows'=>10, | ||
'error'=>false)); | ||
echo $this->Form->end(array('label'=>'Submit Post')); | ||
?> | ||
</fieldset> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
<?php | ||
// The $this->element accepts the name of a file stored | ||
// in the view/elements folder (add_or_edit in this case), | ||
// without the file extension (without .ctp). | ||
// It simply transfers the content of add_or_edit.ctp into the add.ctp. | ||
echo $this->element('add_or_edit'); | ||
?> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters