PHP syntax highlighting code editor - php

I need a configureable and extendable in browser code editor using JS and/or PHP (no python or flash etc).
Something like code.google.com editor (it rocks!) and I really like the diff capability it provides. It would be cool but I can't find info on what editor it is employing.
Anyone know something like that? Or if code.google.com's code is open Source? If yes, where can I get it?

I think this has been previously answered with CodeMirror being the preferred choice and it is apparently used by Googles code playground. See Is there a good in-browser code editor? for more information.

Related

how do I find out what php function from Wordpress is generating blocks of HTML using browser inspector?

I'm developing a Wordpress site, which I'm fairly new to. I'm not sure if this is a stupid question or not but I haven't been able to return any decent google results regarding this. Anyway, is there a way to find out what PHP function is generating a piece of HTML code using a browser code inspector like Chrome's? Thanks!
No.
Once the data arrive to the browser, all the PHP code have been processed and you can't know what part of PHP generated which part of the HTML code.
No - not without modifying the php code to enable some kind of debugging. Chrome can only give you information about the received html document on the client side (you). But php code gets parsed server side.
You kind of can:
Download a copy of the theme and plugins folder
Open the page on your site that you want to find the function for.
Find a div/class that is specific to section e.g. <article>
Open a text editor like notepad++ (one that will allow you to search through multiple files at ones)
Use the find feature of chosen text editor and search for the div/class
The result will show you a list of pages where that term is.
Look through those pages for the function you are looking for (it might take a few goes)
The above it is a bit of a roundabout way of doing it, but I think other than looking through each file separately, it is you next best way.

Need a live PHP editor like dreamweaver

I am in need of a live editing software for PHP like there is DreamVeawer for CSS. I need the functionality that I can select items from the webpage and it will highlight the particular source code for it. If anyone knows about such a software please let me know.
Thanks in advance.
Firefox has a nifty add-on called Web Developer. You can't edit the PHP code directly because it's server side but you can highlight/edit the resulting HTML. You can find it here https://addons.mozilla.org/en-US/firefox/addon/web-developer/
Use google chrome's webkit inspector, it will find you the right html source code, which you can then trace back to the PHP code.
I'm afraid you won't find a solution for that.
PHP runs on the server-side and doesn't render any code to the browser like HTML does.
The closest you'll come is selecting DOM elements in Firebug/Dreamweaver(or any other designy IDE) rendered after the PHP is parsed
Im not sure what youre looking for exactly. If you want a WYSIWYG html editor they are plenty.
If youre tring to trace function and method calls in code then you need an IDE with code assist. Both Eclipse and Netbeans with their respective PHP plugins have this - i.e. you click on a function call and it opens the file containing that function. Depending on the context this can also work with variables...
I think there are also WYSIWYG html plugins for both but im not sure as i dont use them.
This isn't exactly what you want but this IDE can give a help
Aptana http://www.aptana.com/
or
PHPStorm http://www.jetbrains.com/phpstorm/

tinymce code highlighting just like stackoverflow?

im using tinymce for my text editor, i wanted a code highlighting feature for one of the buttons on the toolbar, but i wanted a simple one like the one stackoverflow uses, deos anybody know of anything out there, or deos tinymce have something like this build in :)) thanks for the support!
p.s. im using the jquery tinymce
Stackoverflow uses the markup language Markdown. Server-side it's "rendered" by MarkdownSharp (C# implementation, but there are PHP ports as well). The client-side text editor is WMD.
Syntax highlighting is done using code-prettify.
See https://meta.stackexchange.com/questions/10369/which-tools-and-technologies-build-the-stack-exchange-network.
You probably won't be able to easily fold this into TinyMCE. You're either using Markdown, or a WYSIWYG text editor. Both at the same time is a contradiction.

Question about software that tracks divs better than notepad++

I recently got hired as a web developer, and the project that I am overseeing has a formatting issue on one of the pages because one of the divs is out of whack. It is a fairly complex page with quite a bit of php, and from what I can gather, I am missing a </div> tag somewhere, and accordingly everything is messed up.
I am currently using notepad++, which is decent at lining up divs, meaning that if you click on the opening div tag, it will highlight purple and also highlight the closing one. But it seems as though if you have div tags that span several lines (hundreds) it won't work.
Has anyone else run into a similar situation? Is there a better editor I could be using that would do a better job of helping me with my div issue? Or do I have to go through and line up the divs 1 by 1? (there are like over 100). Please let me know!! Thanks
An alternate route I would like to suggest is running your page through a validator, such as the W3C service at http://validator.w3.org
HTML Validator is an addon for Firefox that can automatically run your pages through a local validator and notify you of any issues with an icon in the satus bar.
You want an editor that detects and highlights syntax errors in markup (as well as validity). There are many. I use Komodo Edit from ActiveState (www.activestate.com)
A cross platform solution is Eclipse (PDT). It comes with a nice and handy html editor. For quick file changes and hotfixes I use TextMate – but this is OS X only :(
Sometimes, when I have crazy X/HTML that I am trying to clean up/debug I put it into an XML editor and let it do some of the matching/formatting for me. My personal choice is Altova's XMLSpy. It is not free (hell, it's not even cheap), but I really like the power it has. You can download a free demo from their website and see if it helps you out.
Like what others have said, use a free editor like Eclipse. Open your HTML in Eclipse, then press CTRL+SHIFT+F and it will format and indent the code, just like what Notepad++ does.
Is this page already online in public area?
If yes, did you try to validate the HTML/XHTML with W3C validator http://validator.w3.org/, it might tell you the exact line where the closed DIV tag is missing.
UPDATE: you can also copy and paste code of the page deirectly into the validator and validate it: you go with your browser at the page, then you select "View Source" from the browser manu, than you copy & paste code into W3C validator.
You could try using a more "Powerful" editor such as Eclipse or Netbeans. I use Netbeans for most of my HTML / PHP development, and it does a good job of highlighting matching tags.
Vim + matchit plugin
I use http://users.rcn.com/creitzel/tidy.html#tidyui for fixing html.

Dreamweaver extension to beautify PHP/JavaScript/jQuery code

I'm looking so long for a Dreamweaver extension to auto beautify PHP / JavaScript / jQuery code. Currently Dreamweaver can beautify only HTML and CSS (Apply Source Formatting).
Any kind of help will be much appreciated.
Online solutions for validation and formatting JavaScript:
Validate JavaScript code:
http://www.javascriptlint.com/
Format JavaScript code:
http://jsbeautifier.org/
For the PHP side of things use https://github.com/fabpot/PHP-CS-Fixer
This short excerpt and more information is taken from the README.
Installation:
Download the php-cs-fixer.phar file and store it somewhere on your
computer.
Usage:
The fix command tries to fix as much coding standards problems as
possible on a given file or directory:
php php-cs-fixer.phar fix /path/to/dir
php php-cs-fixer.phar fix /path/to/file
I have found this great dreamweaver extenstion, just give it a try
Their Homepage: http://www.decodize.com/projects/
extension download page: http://www.adobe.com/cfusion/exchange/index.cfm?event=extensionDetail&loc=en_us&extid=2107536
You can use PhpEdit, it's an extra debugger!
DW doesn't do debug, you find the error if and only if you run your code.
With PhpEdit, it is onTime.
Maybe try http://www.javascriptlint.com/
says it works on some IDEs, maybe DW is one of them.
Try googling, but use 'code format' not 'beautify'
I was wondering if you could elaborate on how to set this up. I see the CSS and Tag Libraries options under "Advanced Formatting", but I am stuck at that point as to how to get my PHP to start auto-indenting.
Or, if Dreamweaver has somehow fixed this problem, let me know! It seems like every other IDE has an auto-indent feature! Thanks :)
It's been a while since I have used DW, I use Aptana now and there is an option to format the code from one of the drop down menus. Just use something like "control a" (To select all your code), "control f" (To format your code). There might be another key combination but I think this will work if memory serves.
Maybe "esc control f"
I've not seen anything for Dreamweaver, but if you can copy ans paste the code, http://jsbeautifier.org/ can help you with making code look a good bit better. I've just tried it on some packed JavaScript and it worked out very well. You can also download the application and run it locally (it's only HTML and JavaScript), so you won't need an internet connection to get your code prettier.
Best way i found is to set the way Dreamweaver displays code yourself. Sure it takes some time to do but its worth it.
Here is how:
Dreamweaver: Edit > Preferences > Code Format
Then under Advanced Formatting you can pick CSS... or Tag Libraries...
You can make any of your code look as it should this way.
Like i said, will take some time but do it once and you can keep using it with all your future Dreamweaver versions.
In Dreamweaver CS6 no need any other extension or tools.
Just select your code and then Go to 'Commands' > 'Apply Source Formatting' or 'Apply Source Formatting to Selection'
Done. :)

Categories