Guest User

Untitled

a guest
Jul 19th, 2018
81
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.20 KB | None | 0 0
  1. ## projects_controller.php
  2.  
  3. function add() {
  4. if (!empty($this->data)) {
  5. $this->Project->create();
  6. if ($this->Project->saveAll($this->data)) {
  7. $this->Session->setFlash(__('The Project has been saved, make sure to export the changes to the live site by clicking the export link.', true));
  8. $this->redirect(array('action'=>'index'));
  9. } else {
  10. $this->Session->setFlash(__('The Project could not be saved. Please, try again.', true));
  11. }
  12. }
  13. $projectCategories = $this->Project->ProjectCategory->find('list');
  14. $this->set(compact('projectCategories'));
  15. }
  16.  
  17. ## views/projects/add.ctp
  18.  
  19. <?php echo $form->create('Project');?>
  20. <fieldset>
  21. <legend><?php __('Add Project');?></legend>
  22. <?php
  23. echo $form->input('name');
  24. echo $form->input('address');
  25. echo $form->input('description');
  26. echo $form->input('project_category_id');
  27.  
  28. ?>
  29. </fieldset>
  30. <fieldset>
  31. <legend><?php __('Project Images');?></legend>
  32. <?php
  33. echo $form->input('Image.0.url', array('label'=>'Image URL'));
  34. echo $form->input('Image.1.url', array('label'=>'Image URL'));
  35. echo $form->input('Image.2.url', array('label'=>'Image URL'));
  36. ?>
  37. </fieldset>
  38. <?php echo $form->end('Submit');?>
Add Comment
Please, Sign In to add comment