Monday, December 15, 2014

Re: 3.0 using FormHelper inside MyHtmlHelper

How does your helper look like? What is on line 323?

On Sunday, December 14, 2014 5:32:59 AM UTC+1, Ahmad baiquni habibi wrote:
hi, I try to do http://book.cakephp.org/3.0/en/views/helpers.html#including-other-helpers into MyHtmlHelper, but get error. Please help how to do it properly?

here my code:
<?php
namespace App\View\Helper;
use Cake\View\Helper\HtmlHelper;

class MyHtmlHelper extends HtmlHelper {
    
   
    public $helpers = ['Form'];
    /*
    Fatal Error
    Error: Call to a member function build() on a non-object
    File E:\xampp\htdocs\portfolio\hrd\vendor\cakephp\cakephp\src\View\Helper\HtmlHelper.php
    Line: 323
    */
       
    public function edit($id = null){
   
        $title = 'edit';
        $url = ['action'=>'edit', $id];
        return $this->link($title, $url, $options = array());
   
    }
   
    public function hapus($id = null){
        $title = 'hapus';
        $url = ['action'=>'delete', $id];
        $options['confirm'] = 'yakin menghapus?';
       
        return $this->Form->postLink($title, $url , $options);
   
    }   
   
}



--
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP

---
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscribe@googlegroups.com.
To post to this group, send email to cake-php@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php.
For more options, visit https://groups.google.com/d/optout.

No comments: