Skip to content

11. 'Edit existing post' feature

Latest
Compare
Choose a tag to compare
@artingo artingo released this 27 Nov 21:09
· 6 commits to master since this release

Implement the 'edit existing post' feature:

  1. add a new rule to the routes
  2. remember the current user id in a session variable
  3. only a post's author should have the right to edit it
  4. add a small <form> with a hidden 'id' field.
  5. create the controllers\posts\update.php controller
  6. in controllers\posts\create.php, create a new, empty Post and pass it to the view
  7. rename views\posts\create.php to edit.php. Insert some hidden fields.
  8. fill all fields' values with the post's data
  9. modify the code in controllers\posts\save.php to save new and existing entries