How to get code completion for variables into zend

2019-04-15 15:29发布

问题:

i'm evaluating to switch to netbeans ide for managing my zend_framework project;

i'd like to have autocompletion for variable's name into my view, for variables defined in actions as i see in this screencast,

http://netbeans.org/kb/docs/php/zend-framework-screencast.html ,

but i can't figure out.

When i digit $this-> in any view i can't see none variable's name.

I'd like a lot to use this feature.

Thank you, Mirco.

回答1:

You need to have Zend Framework either in the include path for the project within Netbeans or within the project itself.

You can then use cmd+space after a "->" to autocomplete an object's methods. If Netbeans doesn't know the object you can use /* @var $objInstance Object_Class_Name

Within a method call, you can use cmd+b to see the parameters of the method.



回答2:

Here is a code example for the view using Robs solution.

<?php
/* @var $this Zend_View */
?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
        <title>Zend Framework Default Application</title>
    </head>
    <body>
        <?php echo $this->layout()->content; ?>
    </body>
</html>