Reputation: 55
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?
Upvotes: 0
Views: 189
Reputation: 9265
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).
Upvotes: 1
Reputation: 9717
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);
}
Upvotes: 1