PHP code navigation in Dreamweaver CS 5 - php

I have started to use Dreamweaver CS5 for PHP coding. The PHP syntax highlighting works fine but I don't get code completion and navigation to work.
For instance in other editors if I press the CTRL key while the mouse cursor is over a variable or function then I can jump to its definition with a mouse click.
Another problem is that when I define a class, usually a hint with a list of methods should appear after inserting "myinstance->" which is not the case in Dreamweaver.
Does Dreamweaver support this? If yes, how can I enable this functionality? Does this also work if the class definition is in a separated file which is referenced with "include"?
Regards,

I am using aptana studio based on eclipse but slightly faster than eclipse. It has very nice features such as suggestions, auto-complete, code-formatting, highlighting, showing syntax errors on the fly

Attaching a css file can help.
Open a php file -> right click on the page -> CSS Styles -> Attach Style Sheets..
Select your css file. The Code Navigator will be activated

Dreamweaver is not a good PHP IDE, other than syntax highlighting it offers little in the way of tools to help a programmer.
I'd recommend NetBeans as a good free IDE for PHP development. Eclipse is also free, but I understand that the latest version doesn't really have a working PHP module so you'll have to use the previous to current version.

Related

Is there a way to make Visual Studio Code recognize HTML syntax in PHP files

I am using Visual Studio Code on a Mac to work on WordPress applications.
Is there a way to make Visual Studio Code recognize HTML and use it's features (mainly autocompletion) inside PHP files?
I've searched for this answer before but just get told to Go to Visual Studio Code Settings: File >> Preferences >> User Settings
// Place your settings in this file to overwrite the default settings
{
// Configure file associations to languages (e.g. "*.extension": "html"). These have precedence over the default associations of the languages installed.
"files.associations": {"*.php": "html"}
}
But doing this makes you lose all PHP support and autocompletion.
I wish Microsoft would realize that PHP developers commonly use PHP and HTML together when creating applications/websites. I would love to use VS Code instead of the magnificent but expensive PHP storm if possible.
You can install this plugin:
PHP Intelephense
As far as I can tell, it does. Take a look at this php file I have created in VS Code (no extensions), with HTML inside the file with syntax highlighting for both languages.
There is a button (It should say the word PHP) in the bottom right corner of the screen that allows you to switch the syntax highlighting and autocompletion to another language, and while this does temporarily turn off PHP syntax, it will allow you to code in HTML a lot easier.
You can enable html support in any language by adding the following to your settings.json file:
"emmet.includeLanguages": {
"your-language": "html",
"rust": "html",
"php": "html",
"javascript": "html",
}
Very easy solution
Search emmet in settings and remove php form Emmet: Exclude Languages list
This will definitely work for everyone
I also faced this genuine concern while learning PHP, and the only solution I came up with at the moment is clicking on PHP button on bottom right corner of VS Code screen.
I am attaching the screenshot below with that PHP button highlighted so you would be able to locate it easily. Once clicked it will ask for a language you want autocomplete to work on, select HTML and it would start autocompleting html, click again to enable PHP autocomplete.
I also happened to come across GitHub Pilot Extension, you need to be a student for availing this service for free or you'll have to buy membership, It is a good tool for auto complete although that is not the gist of it's use, It is something great invented for learners and also professional coders.
I used to use PHPEd and it has content-aware autocomplete. It knows the content that your cursor is in: php, html, css, js, etc and suggests tags/attributes/functions/etc based on the language where the cursor is. The entire problem with VSCode is its decidedly unintelligent “intellisense” that relies wholly on what language the document is defined as. Any IDE worth its salt is going to have content aware auto-completion. The only satisfactory answer to your question is make your own snippets and turn off emmet and php auto-completion.

What PHP/JS specific features does Dreamweaver CS5 have?

I'm debating on whether to get Dreamweaver CS5 or Zend Studio for my web developing. I was happy with Dreamweaver until I tried Zend Studio (and Netbeans for that matter) and realized what kind of great code formatting and completion I was missing out on.
My question is, does the newest version of Dreamweaver support:
PHP / JS formatting
Code completion (including custom classes)
Don't know if this will help much b/c I don't know what previous versions of DW had or didn't have. I was using the old Homesite/Coldfusion Studio editor before starting a new job where I had to use DW CS5. For PHP it will help with auto completion of variables, both $_(whatever) type, as well as one's you've previously defined on the page.
DW also checks for things like missing ";" at the end of lines and brackets not being closed correctly when you're doing a bunch of function(calls(inside(other(functions())))).
If you want the WYSIWYG part, it's there, but it's trivial to make it go away and stay on a "code only" view.
Not sure about the JS side as much. I usually debug via Firefox tools.
Hope that helps.
D.

Finding subtitute pluggin (After Switching from Notepad++ to Netbeans 6.8)

i would like to ask about some Notepad++ feature that i couldn't find in netbeans. And this feature is somehow really helpful. It's called 'function list' created by Jens Lorenz.
this feature will list all of declared function in a PHP files. So, is there any subtitute plugin that i can use to smooth my migration from Notepad++ to Netbeans ?
the main reason i switch is for svn, Phpdoc-support, and easiness maintaining medium-size web project.
What version of Netbeans are you using I am currently doing my php development in Netbeans 6.8 and it already has this functionality.
If you are looking for all functions in all files, i'm not sure that netbeans has this.
When I create a php file it displays all of my functions in the class navigator like this:
(source: developer.com)
If you do not see the navigator you can display it by pressing Ctrl+7
Netbeans has this by default, it is called the 'Navigator' CTRL + 7
You may also want to check out Alt F7 which is the Find Usages shortcut, it comes it very handy for finding every place a variable is used or when a function is declared/used

Enable PHP highlights in VS 2010?

I've heard that Visual Studio 2010 Beta 2 has support for PHP. When I load a PHP file though, it has nothing highlighted and is nothing more than a glorified text editor.
Is there a way to enable it?
You can enable syntax highlighting for php files using a simple hack in Visual Studio 2010 (might also work for earlier versions)
Open Tools -> Options dialog from the menu, and select Text Editor -> File Associations on the left. Add php as a new extension and select 'Microsoft Visual C++' in the adjacent combo box. Apply and now you and open and edit any php file in Visual Studio with Syntax highlighting and code folding. The only problem come is when the file has mixed php and html code. It does not look really good and editing is painful.
I have tried VS.php, and I am certainly not impressed. The only thing it can add to visual studio is creating a php project easily, otherwise, I haven't been able to find it any more useful.
As far as I know, we don't do PHP support out of the box. You probably need a third-party component such as this one: http://www.jcxsoftware.com/vs.php
I've found by using the VS2010 script editor for PHP it does 90% of what I wanted.
As Samnan states - goto Open Tools -> Options dialog from the menu, and select Text Editor -> File Associations
and told VS2010 to use its script editor
Also XRefresh plugin for firefox is quite handy for quickly viewing code changes on a second monitor running firefox.
On Microsoft Connect, it seems that this is a feature request. And they've talked about it on MSDN. But so far, syntax highlighting doesn't seem to be a builtin feature just yet. Though, Expression Web 2 and 3 do have IntelliSense in the HTML designer, we could be seeing native syntax highlighting in the Visual Studio 2010 RTM come March.
Hope this helps.
I've heard rumors about them adding it in the final release, however there is no native support for PHP within the beta right now.

PHP syntax highlighting in Visual Web Developer?

I recently installed PHP 5 on IIS, however, I am unable to find a PHP syntax highlighting plug-in or extension for VWD. Where can I find a plug-in? I thought there was an official one.
Consider PHP IDE for Visual Studio.
http://www.jcxsoftware.com/vs.php
I have used this and it adds a lot of nice PHP specific features to Visual Studio.
From their site...
Editor and File Management
•PHP4 and PHP5 Support
•Syntax Coloring for PHP, Smarty, HTML, JavaScript, CSS, XML and XSLT
•File templates for PHP, Smarty, HTML, JavaScript, CSS, XML and XSLT
•Intellisense for PHP, Smarty, HTML, JavaScript, CSS, XML and XSLT
Debugging
•XDebug and DBG support
•Debug PHP, JavaScript and .Net in one single session
•Built-in Apache web server for ease of debugging. Preconfigured with Php4, Php5, XDebug and DBG.
I've tried a lot of text editors, some free, some commercial. So far Visual Studio is the only one that has the right combination of features to be most useful to me. So, coding PHP in VS is important to me.
You can trick Visual Studio (and hopefully also Visual Web Developer) into thinking .php files are C++ with a registry hack. The syntax highlighting is close enough to be useful.
This blog post explains how to do it for all versions of VS: http://blog.cumps.be/visual-studio-2008-and-php-coloring/
I don't know about older versions, but VWD 2010 allows you to link any extension to any type of formatting in its options.
Tools->Options
click 'show all options'
Expand 'Text editor'
click on 'file extensions'
type in 'php' and select how you want it to be formatted (I recommend the Automatic Editor Selector), click Add
And there you go! Next time you load the page you will see the changes. If you don't like it, there's 20 other styles to choose from.
There is no official plugin for PHP for Visual Web Developer. I believe that this is because Microsoft would rather you use their .NET products, (notably ASP) which serves most of if not all of (I can't exactly say as I don't really use ASP as much as PHP) of the functionality of PHP.
There are however, some very good PHP IDEs out there. A list of which you Here
thx, I use the last post with "HTML format" instead "automatic editor selector"
I would recommend using Netbeans. It has code completion for PHP and runs xdebug for debugging. I've been using it for over a year and the support for PHP just keeps getting better.
Definitely worth trying.
I would recommend Visual Studio with this Extension :
http://phalanger.codeplex.com/
It is free and gives you more functionality than most of the expensive tools.
if you're using windows there's an application called notepad++ that will do syntax highlighting for dozens of languages. I used it for C but I know it has a php syntax highlighter and many more languages coming along. Check it out on sourceforge. If your using Linux or Unix you can use K Advanced Text Editor (kate). It also has a console window built in.
What I am looking is for a debugger for PHP that is as useful as the one built into Visual Studios. I searched high and low for this and there seems to be none that works well.
What I used is the PHP Designer 2007 - Personal Version 5.0.2 is a fully functional php editor, for free! from mpsoftware[dot]dk/, however I like using MSVWD a lot too, and now that I've seen how to make php files work in it, I gonna stick with that! Thanks!
btw Aptana Studio looks promising too tho
The closest Visual Studio like PHP environment I have found yet is CodeLobster. It has a free version for PHP and CSS, as well as for pay versions that include for the Pro version a plug-in for CakePHP, CodeIgniter, Drupal, Facebook, JQuery, Joomla, Smarty, Symfony, WordPress and Yii.
It isn't perfect, but it is pretty good and free for the basic version.

Categories