How can I get parameters to automatically appear within brackets? - php

I am fairly new to PHP and its various resources, so apologies if my question/references has not been wording correctly.
Whilst following various YouTube tutorials on PHP Coding for WordPress, I have noticed that many coders are able to automatically generate available Parameters within their strings/arrays etc. I use Notepad++ and as far as I can see, this is the chosen programme within many of these YouTube Tutorials. Is there an extension, within Notepad++, for this or do they use a completely different programme?

Proper Answer is that you are looking for auto completion and linting and there are millions of tools for the job.
If anything I would suggest Sublime, Atom or Visual Studio Code. All are free.
However the likes of PHPStorm can give help you out if you are very new to the language with its completion.
It's not free but you can play with it for 30 days and student offers are good.
Notepad++ is an option too but, its limited.

You can use Sublime Text which is used for PHP

Related

Why would I NOT want to use Adobe Dreamweaver as a simple code editor? [closed]

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 9 years ago.
Improve this question
I am an applications developer for a for-profit college in Virginia. At this point I could code all of what I do in notepad if I wanted to, or had to, but I prefer to use an IDE for speed and organization. As a Mac user, I've used such IDEs as NotePad++, Coda, TextMate, TextEdit, NetBeans, and of course Dreamweaver.
At work my company owns licenses for the Adobe Suite that includes Dreamweaver and I enjoy the code hinting, the grouping of related files, the built-in FTP, the code snippets and custom keyboard actions. I get flack from other developers when I mention that I use Dreamweaver.
Is there a reason why I should NOT be using it...or is it just a case similar to people who think only black and white tattoos are cool and anything else isn't?
The people who object to you using Dreamweaver probably mean the WYSIWYG part which is known to produce tag soup.
By the way, NotePad++, Coda, TextMate and TextEdit are just editors, not IDEs, because they don't integrate build automation or debugging tools out of the box.
The issue most people have with Dreamweaver is that it's a code generator, and code generators are renowned for producing poor-quality HTML. (the main issue with that - other than pride in one one's word - being that it causes cross-browser compatibility issues)
if you take away the code generation aspect, it's a straight fight between any other IDE, and other IDEs are just as good or better.
That said, I haven't used Dreamweaver in a long time so I can't really comment on its current version. Maybe the code generation has improved massively (but I doubt it). Maybe it really is a better IDE than all the rest. In the end, the choice of IDE is a personal one; if you're comfortable in Dreamweaver, then it's a good choice for you.
Any person who gives you flack for your choice of editor is not a true developer. Certain IDEs have certain benefits based on the languages/frameworks they are targeting to speed or ease development pains. If your company bought Adobe, and you like Dreamweaver and code comfortably in it... then keep doing it. Dreamweaver is an outstanding product, and if it does what you need it to do then use it.
None of these developers who give you flack are responsible for your paycheck, so screw them. Use the tool that gets it done. If someone shows you a better one, have no shame in switching. If they don't, keep on keepin' on.
If you like it then use it. It's only up to you which editor to use and to decide is it worth that money.
Obviously we could all do 99% of our coding in notepad, but we choose IDEs for their productivity boosting, code-writing abbilities.
It depends what you are developing in. If you're coding C# and .NET using Dreamweaver would be an odd choice, though you could make it work.
If you're developing client side web stuff in XHTML, JavaScript, and CSS Dreamweaver is a fine choice.
I do like Dreamweaver when I'm building front ends and I want to see what I'm building. When it comes to coding I'd pick another tool. I think NetBeans is great for PHP and I love it how it raises code problems, and HTML issues (especially in regards to accessibility, standards, doctypes). Notepad++ is a godsend! I couldn't develop without it.
One think I always hated with Dreamweaver was the auto JavaScript features (and later SPRY framework) as these appealed to non coders as they provide functionality. What they don't realise is that Dreamweaver will produced bloated, horrible scripts. I once produced a JS/CSS dynamic menu using 2 CSS classes and 11 lines of unobtrusive JS. When getting Dreamweaver to produce something similar using a wizard it produced JS code in my page and a 1200 line JS file.
When I'm writing C# I have to use Visual Studio...
Just something I wanted to get off my chest.
I personally use Eclipse [currently 3.6 Helios], but have worked once on DW and I must say that it is extremely handy when it comes to write HTML or CSS. It is not that useful when it comes to write PHP or other programming languages, but for frontend it is VERY nice.
Funny, I remember a time in pre-Adobe acquisition days when Dreamweaver was considered the serious developer's tool and tools like Front Page were for novices. I agree with others that it may be the code generation aspects that the detractors have in mind. I used them once when I was learning PHP. After seeing the generated code, once was enough. Like you I now use it for it's other features.
If it forces nothing on you (if it lets you edit HTML without adding all kinds of nonsense you're not interested in), and you like using it, I see no reason not to. Especially since you mentioned some interesting features it has that you like to use.
Those "other developers" are probably thinking in black and white, unless Dreamweaver cannot be used as simply a code editor, but I believe it can.
I wouldn't care much about what those other developers think, unless they have compelling arguments. I think you would've mentioned those, if they had any. They're probably also the kind of developer that thinks anything Microsoft or Apple or whatever makes is automatically crap.
I've used it, a few, and quite time ago.
IMHO, the worst feature of Dreamweaver was that the basic layout of almost all HTML web pages was controlled using tables.
If you wanted to write an accesible HTML page (wich was requirement for a bunch of customers) you had to fight against it, and code the divs against its natural tendence to build tables.
Experienced web developers often use plain text editors (with syntax-highlighting) because the richer tools can get in the way as much as they help. However, any tool that lets you control every last character of the code will generally keep any developer happy, and I believe Dreamweaver does allow this via its bidirectional WYSIWYG-code editing mechanism.
Anyone who knows enough about coding to complain about "tag soup" or the spaghetti Javascript Dreamweaver produces should also know how to close the "snippets" toolbox and just use the program for what it's good at.
I personally find Dreamweaver's Live Code to be an excellent tool for debugging jQuery.

Using Emacs for Web Development? (Php/mysql/javascript/css/html

I'm a Web developer. I had been using a variety of editors and ide-s for web development(php, javascript,html,css) six months before I decided to learn a true editor and started using emacs. I learned all the basics, used the starter kit, practiced using buffer, windows etc..
I got a grip in 2 months. A month ago I started learning about vim and I found a lot of plugins to achieve the things I want. I'm finding to achieve the same effect in emacs you have to do a lot(for php/js/css/html editing).
Here are the list of things I'm finding hard. Note: These things are related when I'm editing php/html/css/js.
syntax hightlighting(php/smarty). -- the php major mode is too old and it always highlights html/smarty inside the php code incorrectly.
I love ido-mode but i couldn't find how to define a project and fuzzy match files inside the predefined directory
I can setup nerdtree plugin to get a quick overview pane on the left with the files I'm working on with vim. But configuring speedbar and source code browser in emacs is bit difficult.
Context aware completion I really don't know how to do that. I have seen something like that in clojure mode where it shows the definition of a method in the messages area.
Tags-generation: The tags generated with excrebant-ctags does not always work with php. In vim it is easy I can open a file containing the definition right under the cursor.
Manual lookup I want to lookup the manual for a particular word under the cursor without opening the browser (in the messages area(mini-buffer)).
I love ido mode and switching b/w files in tramp,buffers,local files using ido-mode.
Can anyone point me in the right direction? Do you use emacs for same kind of editing I do? What is your work flow?.
nxthml-mode is the ultimate mode for web development.
You can easily define a project in terms of its VCS or .dir-locals.el with find-file-in-project.
Fuzzy matching is called flex matching in ido. You can enable it with:
(setq ido-enable-flex-matching t)
I've never had any problems with ctags, manual lookup is trivial to implement...
Manual lookup I want to lookup the manual for a particular word
under the cursor without opening the browser. (in the messages area
(mini-buffer))
It sounds like you are after eldoc-mode support for PHP? (enable it on a lisp file to see example)
;; Major modes for other languages may use ElDoc by defining an
;; appropriate function as the buffer-local value of
;; `eldoc-documentation-function'.
A search for eldoc-documentation-function and PHP turns up this:
http://www.emacswiki.org/emacs/php-doc.el
I like Emacs for small projects and quick editing.
There are things like C-x ( to make a repeat-macro, delete-matching-lines, describe-function (...), apropos, the quick C-x 2 to split window, the warnings (text was edited elsewhere do you really want...) and the quick Lisp fix in .emacs that make me having an Emacs open at all times.
But for bigger projects, when you want to hover a keyword and have its definition, the call hierarchy, the updated syntax highlighting etc... Emacs is not enough for me. I use Eclipse (which is slow and not perfect anyway for C C++).
syntax hightlighting(php/smarty). -- the php major mode is too old and it always highlights html/smarty inside the php code incorrectly.
The simplest and best way to manage mixed languages in one single buffer is to clone the window showing it with C-x 4 c and use different major modes for each window showing this single buffer, for example, one window with the php-mode, one window with the nxhtml-mode to correctly highlight the HTML syntax.

Does a PHP library exist to work with PRC/.mobi files?

I'm writing a WordPress plugin to create an eBook from a selected category in most major eBook formats. I would like to support MobiPocket since that's the format used by the Kindle but I'm not sure how to go about it. From what I've read .mobi files are actually Palm Resource Databases (PRC) but I haven't been able to find a PHP class to work with these.
I thought about using exec along with KindleGen but that would be undesirable as it would complicate initial setup. I've also thought about hosting a web service somewhere and using XML-RPC to accomplish this but that also complicates things.
My question is: is there a PHP class/library (PHP-only preferred) that can work with PRC or even better, a class that specialises in creating MobiPocket ebooks? (needs to be open source since I'm releasing under the GPL)
I've tried searching but haven't been able to find anything.
I don't know whether you're still looking for this PHP library, but just in case: https://github.com/raiju/phpMobi. This is a library that creates mobi files from html files.
It's should still be seen as an experimental version, but it should work without a problem for basic document with a few images.
Unfortunately not; however, the binary compiled format is an open specification available at:
http://www.mobipocket.com/dev/article.asp?BaseFolder=prcgen
The only direct way of transforming the uncompiled format is using the native XML functionality of PHP to create them and then invoking a compiler with exec, which I understand you don't want to do. If you go with this route, the link above also has details about this XML format.
You might want to try the mobiperl tools,
https://dev.mobileread.com/trac/mobiperl/wiki
Please note I haven't tested them yet. But they have been
around since at least 2007 so they should work well by now.
google "Mobiperl - Perl tools for handling MobiPocket files" to
find a thread on mobileread board discussing it. As a new
poster I can't put 2 hyperlinks into my reply.
Another tool I have recently found (but not yet tested), is: http://www.phpclasses.org/package/8173-PHP-Generate-Kindle-ebook-file-in-mobi-format.html#files
It is based upon KindleGen, and looks pretty straight forward to implement.

Any netbeans features that will make my day?

I've recently gotten quite fond of netbeans for my php work because of the XDebug integration. It has made me all but forget about textmate (which imho still beats netbeans for the little things)
What do you think is the one awesome netbeans feature I should know about, and more importantly why and how do I use it?
I'm asking this to optimize my skills in the use of the IDE and based on the idea that what works well for others might just work for me (and hopefully others).
I've found another great snip of genius i wanted to share:
you can do custom code folding (not really related to php, just netbeans)
just put this into a code file:
// <editor-fold defaultstate="collapsed" desc="getters and setters">
some boring code you don't need to see every time here
// </editor-fold>
That'll behave similar to #regions in visual studio or pragma marks in xcode. but unlike regions, it doesn't screw up the working of your code, it's really just a comment!
The Subversion Integration directly on the IDE and the Local History are of my must-use, favorite features.
I find the single most useful feature in Netbeans for PHP work is that it understands PHPDoc (in the same way that it understands Javadoc), and uses it for type hinting.
Type /** before a function definition, hit return and it'll create a PHPDoc template.
/** <-- I typed this one line
* #param <type> $otherObj <-- Netbeans added these 3 lines
* #return <type> <--
*/ <--
public function exampleFunction($otherObj)
{
$myObj = new MyClass($otherObj);
return $myObj;
}
Replace the <type> placemarkers with the appropriate types:
/**
* #param OtherClass $otherObj
* #return MyClass
*/
public function exampleFunction($otherObj)
{
$myObj = new MyClass($otherObj);
return $myObj;
}
And voila, you'll get type completion (and pop-up documentation) with Ctrl-space.
Awesome Vi bindings via the jVi plugin.
if ($x instanceof SomeClass) {
$x->.... // now it has code completion with SomeClass' methods.
}
Macros, and Code Templates with advanced input !
Parametrized code templates (try typing fnc in netbeans and then imediately press Tab, and then keep pressing Tab to see what happens, how it cycles through the function name and the function parameters - look inside the code template to see how this is done).
(Options > Editor > Code Templates )
Some easy examples (some I made, some come with netbeans):
[forek] expands to: [foreach ($array as $key => $value) { }] (This one comes with netbeans, the rest I made)
[arr] + Tab expands to: [array();]
[kv] +Tab expands to: ['key' => "val", ] (key and val are parameters that I canc cycle through and edit with tab. The code template looks like this: ['${key}' => "${val}", ] where [${something}] is a template parameter, it prints [something]. if you want it tio print [$something] I think you have to use three ]$] characters: [$$${key}])
EDIT: You can make a code template for the arrow with a single letter (like 'm' for ex) , but when you type in code you have to put a space before the letter, else it wont recognize it. Ex: $obj m[press Tab], expands to [$obj ->]. The space inbetween works ok and is not a sintax error.
/EDIT
Every time I wish there was a template for something, I actually insert the template and then use it imediately and continue with the rest of the php programming.
Macros with shortcuts as mini code templates ! (Netbeans >Menu > Edit >Start / Stop Macro Recording)
Best Macros I made for php are actually Code Templates (because ' + Tab doesnt work as code template for some reason, only if the template begins with a letter it works) ([shortcut] inserts [text]):
shortcut [Ctrl + ;] inserts [->] (no more
keybooard gymnastics, no more dot
sintax envy on other languages :))
shortcut [Ctrl + Shift + ;] inserts [ => ]
This link has a lot of keyboard shortcuts that comes in handy. I have a copy of it printed out and pinned to the wall next to my computer. Sadly, I don't see any special PHP shortcuts though.
UPDATE: http://netbeans.org/project_downloads/usersguide/shortcuts60.pdf
UPDATE2: http://netbeans.org/project_downloads/www/shortcuts.pdf (for 7.0)
I would add Tasks integration. Don't have time to finalize something? Add a simple task which NetBeans will track for you. You can customize what gets tracked in Tasks in Options -> Miscellaneous -> Tasks, but I found the format below to be most useful, as it aligns well with PHPDoc comments (see therefromhere's comment):
/**
* #todo Create public setters and __toString() for this class.
*/
Ctrl + Space is my favorite and most used feature when programming in java, I think it is enabled for PHP as well. But if you like net beans you most likely know about it already, if not try it out discover what it does.
Also navigating to the relevant source code by Ctrl + Clicking on anything from variables, to method calls, to class references is a nice feature.
Additionally, the popup menus that are displayed when right clicking in source code contain many useful tools for everything from refactoring to code generation.
This is going to sound ridiculously trivial, but one thing I do in Netbeans is code formatting. Its code formatting (source->format) rocks.
Its SVN integration is great too, but that's already been said.
The ability to create quick on the fly macros.
For example , here is one that will put a semi-colon at the end of the current line and places your cursor back where it was before the macro started.
";" delete-previous caret-end-line ";" jump-list-last-edit jump-list-last-edit
(I know this is present in other language implementations by default. But it does not work by default in PHP Netbeans.)
As someone who tends to stick with IDE for a long time, I love being able to customize little things to make me more efficient.
If you consider Netbeans 6.7 it has a sync feature a bit like Dreamweaver
In the way that you can add a custom ftp, import it to the project and when you save the files locally they are also uploaded to the server so you have a semi backup system in place.
(trust me it's better than working directly onto a ftp tree and realizing that the transfer failed somehow between the current tmp file and the server file and you lost your work because you closed the file window :) )
NetBeans also allows you to completely undock individual windows.
How to:
Right-click on toolbar of the window which you want to move and select Undock window. The selected window becomes a floating one, which allows you to move it outside of the main NetBeans window.
Highlights:
you can pin floating windows to screen borders or to different floating windows (just the ones from NetBeans though)
floating windows can make themselves semitransparent if you move away from them (configurable via main settings in Miscellaneous/Appearance)
if you move a different application over any floating windows, they come back on top after you start using NetBeans again
your workspace layout is remembered, so all floating windows keep their respective positions between individual coding sessions (NetBeans restarts)
This is useful especially if you have a second monitor, as it allows you to maximize the space available for source code by moving any supplementary windows (the file browser, unit test results, etc) away from the main screen. The nice thing is that NetBeans works around most annoyances which are usually present in multi-window applications (e.g. different applications covering individual toolbars in GIMP).
Note: perhaps this is commonly known feature, but I managed to discover it just today. It wasn't on the list yet, so I added it even though I already answered with a different feature some time ago.
Squiglies under unused private class members.
maybe the search box, to find anything in the source code`?
Some features definitely worth looking out for, including the ones mentioned above:
Version control Integration, including Local History
IDE wide search box
Integration with Tomcat/Apache, GlassFish can be helpful when you are looking to work with PHP and other server side technologies, like JSP
Very good integration with MySQL- essential to wAMP/LAMP development
TextMate is a great slick little editor I use all the time on my Mac, but not an IDE. I haven't enjoyed Netbeans on Mac very much being so non-native, but on Windows or Linux I prefer it over Eclipse.
The Swing GUI designer with Java has been huge in getting projects done rapidly.
Other people have said it, but integrated Subversion is awesome. If I've been working with a project from the terminal in Linux it figures out I've got SVN checked out on that directory and handles it fine.
I love the code formatting (right click in the editor), especially when team members write poorly spaced/indented code with nano, xemacs, or something like that.
its amazing that no one has talked about this cool plugin.
http://code.google.com/p/zen-coding/
I have found it very useful for html. PHP developers do need it. It adds a lot of templates like this.
download zen-coding for netbeans and import zip file in tools>options>code templates>import.
I like this the most: phpunit + code coverage
I've personally used Eclipse a couple of years ago for Java development, and ever since i knew Netbeans at version 3.5, it has gotten really good with the integration of server technologies as TomCat for J2EE application deployment, subversion, uml and plenty of plug-ins for different tecnologies, not just java now.
Database integration (MySQL, Jdb, SQL editor).
Continuous progress in PHP integration and features.
Subversion integration...it does help A LOT!
Code indent, custom color highlighting.
If you are a PHP developer, Ruby on Rails integration can be of help too, if you want to expand your expertise on web apps.
Netbeans has always been known for delivering support for experimental (not-yet-released) technologies, such as Java 6 EE preview, JDK7 support, ...
And, subversion support out-of-the box. It's a great difference to Eclipse, where you have to use plug-ins. With Eclipse I had only problems under Linux (JavaHL problems, blabla...). I don't remember who said it, or where it is written, but "out-of-the-box support is much more relevant to a user than the ability to use some plug-ins".

Homesite outline profile editor

I've been using HomeSite since Allaire owned it. I started with plain HTML, then classic asp, now I've been using it for PHP development for quite a while but there's a feature I really want and Homesite only seems to do it sometimes. Most IDEs will show a list of functions on a page. Homesite will sort of doing this with the Tag Inspector feature. If I have a file that is nothing but PHP user-defined functions (ex. require('functions.php')) then all the functions show up just fine. However, if my page is mainly an HTML page with PHP functions added in they don't show up in the outline.
I guess I could have all my functions be part of a 'required' file but I was wondering if any homesite jocks might know of a more reliable way of creating an outline profile that would display user-defined functions
I used Homesite myself. Topstyle kinda took over from it (it was by the same guy), and now TS itself has now been sold on, for version 4 - http://www.topstyle4.com/ - (now in beta).
Code insight for the files/classes/functions isn't particularly unique anymore though - I think the various Eclipse based IDEs and the Komodo IDE can also do it now.
I don't use homesite, but it sounds like perhaps it could be keying off the file extension. Try saving your file with a different extension, for example: save "yourfile.html" as "yourfile.phtml".

Categories