How do I get my HTML5 project in Netbeans to recognize PHP? - php

I have created a web page in NetBeans with Html 5 and CSS, and now I want to add a PHP file in that project, but there is no option to add a php file.
I added empty file (xxxxx.file) and renamed it xxxxx.php and added the php code there, but it doesn't recognize it as php code. It sees the file as php file.
What should I do? Should I create new PHP project and copy the html and css files from my old project to the php project to get them working all together?

You can have php files in HTML5 projects. If you are not seeing the syntax highlighting for the code make sure that your php files have the opening php tag:
<?php
Without this the exitor will not highlight it correctly

if PHP's aren't being recognised you should install the PHP plugin for Netbeans. You should go to Tools > Plugins > Available Plugins and select the ones for PHP in the list. Then, restart the IDE.

It seems there is a Netbeans bug which makes you impossible to add php files to html5 projects. The answer, as given by Netbeans people, is to create a new php project and add the html5 files there.
Here you can see the bug report on netbeans forum: https://netbeans.org/bugzilla/show_bug.cgi?id=226280

Related

Visual Studio Code PHP autocomplete on external librarys

I use the IDE Visual Studio Code to write scripts in PHP. To write plugins in PHP for a store system, I need to add an external library to my worktree. I have already cloned the library from github and added the folder to my workspace where I am working on the plugin.
The problem is that my IDE still gives errors that namespaces and classes can't be loaded because, for example, there is no namespace with that name. I also can't use the autocomplete feature.
Can someone explain me how to fix this problem?
Screenshots:
Undefined Type [...]
I have solved this problem now! To fix this problem I needed the vscode plugin "Intelephense".
In VSCODE: right click on the folder where the interface must be used and click on "Folder Settings". In the second row under the intelephense extension the radio button "Intelephense > Environment: Include Paths" is shown. There I had to add the path to the interface.

How to add External Dependencies to a PHP project?

While trying out the VSCode on my PHP projects, I couldn't find an option/setting/extension that would allow me to add an external library and show any autocomplete tips based on the included code.
This feature is present in PHPStorm out of the box.
Am I missing something or VSCode really doesn't support this yet?
To add an external dependency you can use the VSCode multiroot workspace feature.
The File > Add Folder to Workspace... command brings up an Open Folder
dialog to select the new folder.
https://code.visualstudio.com/docs/editor/multi-root-workspaces#_adding-folders

Eclipse for PHP, how to make it to include downloaded files in project?

first of all I explain the reason why I try to do it.
I tried many editors/IDEs which could provide convenient syntax and variables check. Eclipse did the best.
But it works correctly only if I work with its project, otherwise there are a lot of glitches and no correct support of syntax suggestion/auto-complete.
I set my FTP client to download files into project's folder, but Eclipse does not recognize them as a part of this project so I still don't have it's full support. If I create PHP files with Eclipse in the same folder it works just fine. Is there a way to make read all PHP files in project folder as parts of a project?
Or, if you can suggest IDE which performs syntax check/auto-complete tasks as Eclipse does please do, I check if I tried it. I can't include all CMS into project, because it is Bitrix, it can kill any IDE which can try to chew it, so I just need a reliable tool which could work as code validation of currently edited script. The perfect tool could just be set for PHP 5.6/7.1 for example and perform validation based on language rules.
If you are trying to get Eclipse php support for randomly downloaded files you can set your FTP client to download that files in project's folder. Then you open Project Explorer in Eclipse, press refresh button to get actual folders/files list, find you file in there and open it by that project explorer. That makes Eclipse to consider that file as a part of your project so auto-complete and validation works fine. Other ways of opening it does not count.

JavaScript Settings missing in PHP project settings

I'm using Netbeans 7.3.1.
I can see JavaScript Files section in my Netbeans projects settings when I create a HTML5 project.
But I want the same for my PHP projects. after all I want to be able to add dependencies as easily as I could, when using HTML5 project.
Is there a workaround to show JavaScript files in PHP projects?
Regards,

HTML project in netbeans

Ok I just installed netbeans for php and i'm trying to create a new project for html/javascript but I only see php project there.
I can create a php project and just create html files inside of it, but it makes me define a project path to localhost. So when I try to run my project, it directs to localhost instead of my project's root folder.
Sorry I'm new to this piece of software so excuse any ignorance.
It redirects because php requires a server. If you have plan to make a project for html and javascript alone you can try with some good html editors like dreamweaver or other IDE's.

Categories