0

I use Netbeans 8.2 for PHP development, and was able to include code completion for Codeigniter framework.

In the controller and models - which in Codeigniter are oop - the code completion works fine.

In the views, which in Codeigniter are always written in procedural style, code completion is not available.

Here is a simple example controller (taken from CI's homepage)

<?php
class News extends CI_Controller {
    public function __construct()
    {
            parent::__construct();
            $this->load->model('news_model'); # from DB
    }

    public function index()
    {
            $data['news'] = $this->news_model->get_news();
            $this->load->view('show_news',$data);
    }
}

In the according view, $data['news'] is accessible by the variable "$news". But when I type "$news" I do not have completion support.

Ideas?

MarkHelms
  • 55
  • 10

2 Answers2

1

Hope this will help you :

you are not passing $data to the view :

public function index()
{
        $data['news'] = $this->news_model->get_news();
        $this->load->view('show_news',$data);
}
Pradeep
  • 9,667
  • 13
  • 27
  • 34
  • thanks, but unfortunately I only missed to write the $data argument here. I have it in my code, but completion does not work. – MarkHelms Apr 09 '18 at 13:22
1

Netbeans doesn't understand CI out of the box (I believe there are some plugins/modifications you can make so it does).

How to integrate codeIgniter with netbeans fully

As such, auto complete functionality won't work and if it did, it would be limited and probably wouldn't understand the view syntax is just the a variable form of the key from an array (that's some AI stuff right there).

Alex
  • 9,215
  • 8
  • 39
  • 82