Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ## projects_controller.php
- function add() {
- if (!empty($this->data)) {
- $this->Project->create();
- if ($this->Project->saveAll($this->data)) {
- $this->Session->setFlash(__('The Project has been saved, make sure to export the changes to the live site by clicking the export link.', true));
- $this->redirect(array('action'=>'index'));
- } else {
- $this->Session->setFlash(__('The Project could not be saved. Please, try again.', true));
- }
- }
- $projectCategories = $this->Project->ProjectCategory->find('list');
- $this->set(compact('projectCategories'));
- }
- ## views/projects/add.ctp
- <?php echo $form->create('Project');?>
- <fieldset>
- <legend><?php __('Add Project');?></legend>
- <?php
- echo $form->input('name');
- echo $form->input('address');
- echo $form->input('description');
- echo $form->input('project_category_id');
- ?>
- </fieldset>
- <fieldset>
- <legend><?php __('Project Images');?></legend>
- <?php
- echo $form->input('Image.0.url', array('label'=>'Image URL'));
- echo $form->input('Image.1.url', array('label'=>'Image URL'));
- echo $form->input('Image.2.url', array('label'=>'Image URL'));
- ?>
- </fieldset>
- <?php echo $form->end('Submit');?>
Add Comment
Please, Sign In to add comment