In <!-- Arquivo: /app/views/contratos/view.ctp -->

Try do this:

<h3 class="title">
    <?php echo $contrato['Contrato']['contrato'] ?>
</h3>
<?php echo $html->link('Excluir', *array('controller' => 'controllerName',
action' => 'delete', `id` =>**
** $contrato['Contrato']['id'])*, null, 'Deseja realmente excluir
contrato?'); ?>

I haven't cake here to test, but try it...

http://book.cakephp.org/view/543/Passing-parameters-to-action



2010/9/22 Gilvan Jr. <skinblac...@yahoo.com.br>

> Olá pessoal, vcs poderiam ver onde estou errando?
>
> a ação de adicionar cadastro está funcionando só que retorna esse
> erro:
>
> Warning (2): Cannot modify header information - headers already sent
> by (output started at D:\servidor\xampp\htdocs\cacex\app\controllers
> \contratos_controller.php:2) [CORE\cake\libs\controller
> \controller.php, line 746]
> Code | Context
> header - [internal], line ??
> Controller::header() - CORE\cake\libs\controller\controller.php, line
> 746
> Controller::redirect() - CORE\cake\libs\controller\controller.php,
> line 725
> ContratosController::add() - APP\controllers\contratos_controller.php,
> line 22
> Dispatcher::_invoke() - CORE\cake\dispatcher.php, line 204
> Dispatcher::dispatch() - CORE\cake\dispatcher.php, line 171
> [main] - APP\webroot\index.php, line 83
>
> a ação de deletar n funciona de jeito nenhum e está retornando este
> erro
>
> Warning (2): Missing argument 1 for ContratosController::delete() [APP
> \controllers\contratos_controller.php, line 27]
> Code
>    }
>
>    function delete($id) {
>
> ContratosController::delete() - APP\controllers
> \contratos_controller.php, line 27
> Dispatcher::_invoke() - CORE\cake\dispatcher.php, line 204
> Dispatcher::dispatch() - CORE\cake\dispatcher.php, line 171
> [main] - APP\webroot\index.php, line 83
> Notice (8): Undefined variable: id [APP\controllers
> \contratos_controller.php, line 28]
> Code
>
>    function delete($id) {
>        $this->Contrato->delete($id);
>
> ContratosController::delete() - APP\controllers
> \contratos_controller.php, line 28
> Dispatcher::_invoke() - CORE\cake\dispatcher.php, line 204
> Dispatcher::dispatch() - CORE\cake\dispatcher.php, line 171
> [main] - APP\webroot\index.php, line 83
> Notice (8): Undefined variable: id [APP\controllers
> \contratos_controller.php, line 29]
> Code
>    function delete($id) {
>        $this->Contrato->delete($id);
>        $this->Session->setFlash('Contrato de No.: ' . $id . ' foi
> excluido.');
>
> ContratosController::delete() - APP\controllers
> \contratos_controller.php, line 29
> Dispatcher::_invoke() - CORE\cake\dispatcher.php, line 204
> Dispatcher::dispatch() - CORE\cake\dispatcher.php, line 171
> [main] - APP\webroot\index.php, line 83
>
> Warning (2): Cannot modify header information - headers already sent
> by (output started at D:\servidor\xampp\htdocs\cacex\app\controllers
> \contratos_controller.php:2) [CORE\cake\libs\controller
> \controller.php, line 746]
> Code | Context
>
> $status =       "Location: http://localhost/cacex/contratos";
>
> header - [internal], line ??
> Controller::header() - CORE\cake\libs\controller\controller.php, line
> 746
> Controller::redirect() - CORE\cake\libs\controller\controller.php,
> line 725
> ContratosController::delete() - APP\controllers
> \contratos_controller.php, line 30
> Dispatcher::_invoke() - CORE\cake\dispatcher.php, line 204
> Dispatcher::dispatch() - CORE\cake\dispatcher.php, line 171
> [main] - APP\webroot\index.php, line 83
>
> e abaixo segue o meu modelo, controller e view, respectivamente:
>
> <!-- Arquivo: /app/models/contrato.php -->
> <?php
> class Contrato extends AppModel {
>    var $name = 'Contrato';
>    var $validate = array (
>        'contrato' => array (
>            'rule' => 'notEmpty'
>        )
>    );
> }
> ?>
>
> <!-- Arquivo: /app/controller/contratos_controller.php -->
> <?php
>
> class ContratosController extends AppController {
>
>    var $name = 'Contratos';
>
>    function index() {
>        $this->set('contratos',
>                $this->Contrato->find('all'));
>    }
>
>    function view($id = null) {
>        $this->Contrato->id = $id;
>        $this->set('contrato', $this->Contrato->read());
>    }
>
>    function add() {
>        if (!empty($this->data)) {
>            if ($this->Contrato->save($this->data)) {
>                $this->Session->setFlash('Contrato adicionado com
> sucesso.');
>                $this->redirect(array('action' => 'index'));
>            }
>        }
>    }
>
>    function delete($id) {
>        $this->Contrato->delete($id);
>        $this->Session->setFlash('Contrato de No.: ' . $id . ' foi
> excluido.');
>        $this->redirect(array('action' => 'index'));
>    }
>
> }
> ?>
>
> <!-- Arquivo: /app/view/contratos/index.ctp -->
> <ul class="list-links">
> <?php foreach ($contratos as $contrato): ?>
>
> <li>
>    <?php echo $contrato['Contrato']['id']; ?>
>    <?php echo $html->link($contrato['Contrato']['contrato'], "/
> contratos/view/".$contrato['Contrato']['id']); ?>
>
>
> </li>
> <?php    endforeach; ?>
>
> </ul>
>
>
>
> <!-- Arquivo: /app/views/contratos/view.ctp -->
> <h3 class="title"><?php echo $contrato['Contrato']['contrato'] ?> </
> h3>
> <?php echo $html->link('Excluir', array('action' => 'delete', `id` =>
> $contrato['Contrato']['id']), null, 'Deseja realmente excluir
> contrato?'); ?>
>
>
>
> <!-- Arquivo: /app/views/contratos/add.ctp -->
> <h3 class="title">Adicionando Contrato:</h3>
> <?php
> echo $form->create('Contrato');
> echo $form->input('contrato');
> echo $form->end('Cadastrar Contato');
> ?>
>
> Sou novo no CakePHP e gostei muito de trabalhar com ele, só que
> empaquei aqui.
>
> Agradeço desde já a ajuda do grupo,
>
> Gilvan da Costa Júnior | Designer web
> R. Desembargador T. Salustino, 2017 - Natal/RN (HomeOffice)
> www.gilvancosta.com | cont...@gilvancosta.com | m...@gilvancosta.com
>
> Check out the new CakePHP Questions site http://cakeqs.org and help others
> with their CakePHP related questions.
>
> You received this message because you are subscribed to the Google Groups
> "CakePHP" group.
> To post to this group, send email to cake-php@googlegroups.com
> To unsubscribe from this group, send email to
> cake-php+unsubscr...@googlegroups.com<cake-php%2bunsubscr...@googlegroups.com>For
>  more options, visit this group at
> http://groups.google.com/group/cake-php?hl=en
>

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en

Reply via email to