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".
Related
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
After enabling "Function parameters hint on input" in Preferences->Backup/Auto-Completion, I get helpful tips for native PHP functions like this:
string|false substr (string str, int start, [int length])
Is there a plugin or something that would make Notepad++ do this for my own functions, much like Dreamweaver does?
Settings -> Preferences -> Backup/Auto-Completion -> Function
parameters hint on input [CHECK]
Is this what you're talking about? Works for me.
I have accomplished this by doing the following:
Edit API XML file used by Notepad++ for the desired language.
Add custom names in Settings > Style Configurator to get highlighting you desire.
Editing the API XML file
The API XML files are located in your installation directory \plugins\APIs. I believe there is a file for each language that has a parser. That parser will determine which pieces of the XML file are required or ignored.
These files are very fragile so here are some tips:
All entries MUST be in alphabetically order by KeyWord or it will silently fail.
Watch out for text that makes your XML invalid in descriptions. From what I can tell Notepad++ doesn't have a schema to tell it that attributes are of type string so all kinds of characters will break the XML and your tips.
Any problems with the XML file will silently fail the tips.
I have used this technique to support a custom API used by a game engine I am working with and it works great. I have an excel spreadsheet to manage entries and create properly formatted XML to be pasted into the correct section of the file, but obviously there are many ways that managing that could be done.
I figured all this out based on these sources:
http://sourceforge.net/apps/mediawiki/notepad-plus/index.php?title=Editing_Configuration_Files#API_files
http://retroaffect.com/blog/190/A_Lua_Language_File_for_Notepad__/#b
(The API file here you can download has the Environment tag in the wrong place, it should be within the AutoComplete tag instead, but it helped me understand the usage.)
Editing the Style Configurator
Screen adding new key word: myNewKeyword
Final result after adding math.tanh with highlighting
I'm not too familiar with Notepad++, however I think unless there is some sort of IDE plugin it would not be possible.
In my opinion, you should use Aptana Studio, it's based off of the Eclipse IDE, and is specifically made for web development/PHP. Although there are plenty of other IDEs out there, here's a few.
Here's a link to Aptana: http://www.aptana.com
Is there a addon where let say I want to see the origin/stack/trace of a variable I can do so?
I primarily want to see where variables are coming from, what classes and files they go through.
If there is another editor that does this well Ill take suggestions as well!
Thanks.
I don't think TextMate is able to do that, with or without a plugin.
-- START EDIT --
When I was still using it and I wanted to see (and possibly jump to) where a method or property came from I just used Search in Project.
-- END EDIT --
Vim in conjunction with ctags and cscope can help you jump from instance to prototype and vice-versa — wether it's in the current file or not — with <C-]> (or <C-$> on my french Mac keyboard); with TagList or TagBar you can see the structure of your code… but none of this can give you the clean overview you are looking for. But there is probably a plugin for that.
But if that kind of features is important for you it is typically a good reason to use an IDE instead of a text editor. In Eclipse, for example, you have a Type Hierarchy view that does most of what you want and possibly other tools to do the rest. I haven't tried every single IDE under the sun but I think a similar or more powerful feature exists in all of them.
Maybe in Emacs…
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.
I am going to start working on a website that has already been built by someone else.
The main script was bought and then adjusted by the lead programmer. The lead has left and I am the only programmer.
Never met the lead and there are no papers, documentation or comments in the code to help me out, also there are many functions with single letter names. There are also parts of the code that are all compressed in one line (like where there should be 200 lines there is one).
There are a few hundred files.
My questions are:
Does anyone have any advice on how to understand this system?
Has anyone had any similar experiences?
Does anyone have a quick way of decompressing the lines?
Please help me out here. This is my first big break and I really want this to work out well.
Thanks
EDIT:
On regards to the question:
- Does anyone have a quick way of decompressing the lines?
I just used notepad++ (extended replace) and netbeans (the format option) to change a file from 1696 lines to 5584!!
This is going to be a loooonnngggg project
For reformatting the source, try this online pretty-printer: http://www.prettyprinter.de/
For understanding the HTML and CSS, use Firebug.
For understanding the PHP code, step through it in a debugger. (I can't personally recommend a PHP debugger, but I've heard good things about Komodo.)
Start by checking the whole thing into source control, if you haven't already, and then as you work out what the various functions and variables do, rename them to something sensible and check in your changes.
If you can cobble together some rough regression tests (eg. with Selenium) before you start then you can be reasonably sure you aren't breaking anything as you go.
Ouch! I feel your pain!
A few things to get started:
If you're not using source control, don't do anything else until you get that set up. As you hack away at the files, you need to be able to revert to previous, presumably-working versions. Which source-control system you use isn't as important as using one. Subversion is easy and widely used.
Get an editor with a good PHP syntax highlighter and code folder. Which one is largely down to platform and personal taste; I like JEdit and Notepad++. These will help you navigate the code within a page. JEdit's folder is the best around. Notepad++ has a cool feature that when you highlight a word it highlights the other occurrences in the same file, so you can easily see e.g. where a tag begins, or where a variable is used.
Unwind those long lines by search-and-replace ';' with ';\n' -- at least you'll get every statement on a line of its own. The pretty-printer mentioned above will do the same plus indent. But I find that going in and indenting the code manually is a nice way to start to get familiar with it.
Analyze the website's major use cases and trace each one. If you're a front-end guy, this might be easier if you start from the front-end and work your way back to the DB; if you're a back-end guy, start with the DB and see what talks to it, and then how that's used to render pages -- either way works. Use FireBug in Firefox to inspect e.g. forms to see what names the fields take and what page they post to. Look at the PHP page to see what happens next. Use some echo() statements to print out the values of variables at various places. Finally, crack open the DB and get familiar with its schema.
Lather, rinse, repeat.
Good luck!
Could you get a copy of the original script version which was bought? It might be that that is documented. You could then use a comparison tool like Beyond Compare in order to extract any modifications that have been made.
If the functions names are only one letter it could be that the code is encoded with some kind of tool (I think Zend had a tool like that - Zend Encoder?) so that people cannot copy it. You should try to find an unencoded version, if there is one because that would save a lot of time.