php - PHPStorm - Suggestions in included HTML -
i can not see suggestion variable $data in default.phtml if include html file default.phtml class code_controller.php method. here code example.
code_controller:
abstract class core_controller{ protected $template; public function display(){ $data['title'] = 'title of site'; if(core_config::$is_admin){ require_once admin_templates_path . $this->template . '.phtml'; }else{ require_once public_templates_path . $this->template . '.phtml'; } } } default.phtml
<!doctype html> <html> <head> <title><?php echo $data['title'] ?></title> </head> <body> content of document...... </body> </html> have idea?
thanks advice.
standard approach in such case: use phpdoc , declare variable there (at top of file), e.g.
<?php /** @var array $data */ ?> ...html code here...
Comments
Post a Comment