Avatar of Jan Mishkin
Jan MishkinFlag for United States of America

asked on 

PHP Editor that finds orphan brackets

I am using Dreamweaver and have a webpage with a floating < on it and can not find it anywhere.  This is happened in the past and I'd like to know if there is such a thing as a PHP Editor that will check for orphan brackets.  We are non-profit, so cheap is good.
PHPAdobe DreamweaverWeb Development Software

Avatar of undefined
Last Comment
Hugh McCurdy
Avatar of Marco Gasi
Marco Gasi
Flag of Spain image

www.netbeans.org: it's really the best ide for php and it is free!
Avatar of twohawks
twohawks
Flag of United States of America image

jedit is still pretty popular, and there's all kinds of plugins available for it, such as this one..
http://community.jedit.org/?q=node/view/3411

;^)
Avatar of Hugh McCurdy
Hugh McCurdy
Flag of United States of America image

The w3 validator would likely find it.  Regardless, I suggest running all web pages through the validator so you can clean up other problems too.  http://validator.w3.org/
ASKER CERTIFIED SOLUTION
Avatar of Jason C. Levine
Jason C. Levine
Flag of United States of America image

Blurred text
THIS SOLUTION IS ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
Avatar of twohawks
twohawks
Flag of United States of America image

Probably worth mentioning, if you are running your own webserver you can run php in lint mode from a command line
php -l <filename>
..will check the code syntax without executing it.
In windows, for the syntactical example shown above, you need the prompt at the appropriate php.exe directory.
Alternatively you can type in the whole php.exe path (in place of 'php').

There is what I believe is a php link checker here
http://www.meandeviation.com/tutorials/learnphp/
..where you can upload your file for checking.

Here's another php lint checker where you can input the code online...
http://www.icosaedro.it/phplint/phplint-on-line.html

These types of checks will not check the html or other code, and may miss things like a missing opening php '<' tag, but is pretty helpful.

The Netbeans suggestion is a good one, btw.
Avatar of Hugh McCurdy
Hugh McCurdy
Flag of United States of America image

Thank for the lint suggestion.  I think the author has PHP code that is generating HTML code where the number of < doesn't match the number of >.  That's why I suggested the w3 validator.

If the author would publish the URL, one of us might even find the mismatch.  
Eclipse with aptana studio plugin. Definetely. Code autocomplete / syntax highlight / many more.
http://www.eclipse.org/projects/project.php?id=tools.pdt
Avatar of Jan Mishkin
Jan Mishkin
Flag of United States of America image

ASKER

I thought that Jason1178's suggestion about turning on "highlight invalid code" would be the easiest try, but it was already turned on.  The NetBean seems like it may be a lot of work to get far enough into it to learn how to run the code validator but I think I will bite the bullet and try it.  If anyone has an tips for me on NetBean it would be appreciated.  Thanks.
Avatar of Marco Gasi
Marco Gasi
Flag of Spain image

What you mean with "run the code validator"? Usually, Netbeans highlight brackets iwith a yellow background, so you only need to place cursor near a brackets and opening and closing brackets are automatically highlighted: scroll the page if the block code is large and if you don't see the closing bracket highlighted, then it is missing.

For other errors, Netbeans highlights them with red circles on the left pane and red signs on the right side near the scrollbar: if you move your mouse over the red circles you get a hint explaining error. I confess often is not too easy understand what is the actual error looking at that hints, but at least you know code is erroneous.
Avatar of Jan Mishkin
Jan Mishkin
Flag of United States of America image

ASKER

I tried loading the NetBeans but it needs Java SE Download Kit, which I downloaded and my Windows 7 machine is telling me the download may be infected with a virus.  I don't think this orphan < is worth all the trouble NetBean may involve.

When I went into the Dreamweaver Preferences, I turned on "Fix invalidly nested and unclosed tags" and I unchecked the "Never rewrite code In files with extensions .config .cs. ihtml....."
I think this second one might have been a mistake because when I now open a file Dreamweaver finds loads of unmatched brackets but the window that pops up is telling me it fixed it in HTML code when I am using PHP files!!!  Did I make a huge mistake?     BTW - this didn't fix my initial problem either.
Avatar of Marco Gasi
Marco Gasi
Flag of Spain image

I'm sorry, I don't use Dreamweaver, but if your Antivirus software signs the Java SDK as a virus, the problem isn't caused by Netbeans, but by your antivirus: I have win7 and used AVG Antivirus before and Avira Antivir later: none has created that problem you tell about. You can live without Netbeans, but I think it will be hard to live without Java SDK so I suggest to check you antivirus

Best of luck with your project
Marco
>> When I went into the Dreamweaver Preferences, I turned on "Fix invalidly nested and unclosed tags" and I unchecked the "Never rewrite
>> code In files with extensions .config .cs. ihtml....." I think this second one might have been a mistake

Yes, yes it was.  If you have inline PHP all over the page and it breaks up tag groups, then setting those options that way will do bad things to your code.
Avatar of Jan Mishkin
Jan Mishkin
Flag of United States of America image

ASKER

So I should have the 2nd one checked, yes?
Avatar of Jan Mishkin
Jan Mishkin
Flag of United States of America image

ASKER

If anyone feels like looking at the site and the source code, here is the link:
http://www.crcweb.org/kosher_articles.php

Many thank!!!
Avatar of Hugh McCurdy
Hugh McCurdy
Flag of United States of America image

@marqusG -- My interpretation of the issue is that the author has PHP code that generates some of the HTML code.  In this case, some of the orphan brackets would be inside quotes.  Unless the IDE was really smart (which it could be) and did PHP processing to generate the HTML code, it wouldn't necessarily see the bracket problem in the HTML end product.

However, a HTML validator (that ran after PHP processing) would see the uneven brackets.

Does that make sense now?
Avatar of Marco Gasi
Marco Gasi
Flag of Spain image

@hmccurdy: hmm, if that is the case, then you're right - and Netbeans wouldn't see brackets problem if these brackets were inside quotes.

@janmishkin If you use Firefox, there's a lot of extensions to validate your code: https://addons.mozilla.org/it/firefox/addon/total-validator/?src=search is that I use

Cheers
Avatar of Jan Mishkin
Jan Mishkin
Flag of United States of America image

ASKER

Thank you both; due to the holiday of Yom Kippur I will not be able to work on this until Monday.  Stay tuned!
Avatar of twohawks
twohawks
Flag of United States of America image

When you come back, will yo uplease answer the question marqusG raises so we can put that to bed ;^)

Happy Yom Kippur
Avatar of Marco Gasi
Marco Gasi
Flag of Spain image

@twohawks: I didn't know to have raised a question...
Avatar of twohawks
twohawks
Flag of United States of America image

My bad. , and good call.. I meant the possibility of coding for PHP processing to generate the HTML raised by hmccurrdy.  

Sorry about the mixup.  I figure it does well if Jan would clarify on that point.
Avatar of Hugh McCurdy
Hugh McCurdy
Flag of United States of America image

twohawk, pencils have erasers.  (No problem)  Jan should be back on Monday.  Don't know which time zone though...
Avatar of Jan Mishkin
Jan Mishkin
Flag of United States of America image

ASKER

My sincere apologies but I have been out sick and just returned to work this past Monday.  Today I asked a programmer to look at the code and through removing and replacing chunks of code he narrowed it down to a coded space followed by the <  somewhere in the middle of the page? Go figure.  Now how do I close the question?  Jason1178 was very helpful for me to learn about the preferences but it didn't solve the problem.  Jason1178 I did set your suggestion as helpful.
Avatar of Hugh McCurdy
Hugh McCurdy
Flag of United States of America image

I suggest you ask a moderator.  Click on Request Assistance.  This will open a page with a text entry box.  Type your question about closing the question in that box and a moderator will see your request for help and assist you.  (It normally takes a few hours but the moderators are very good at getting back to people.)

PHP
PHP

PHP is a widely-used server-side scripting language especially suited for web development, powering tens of millions of sites from Facebook to personal WordPress blogs. PHP is often paired with the MySQL relational database, but includes support for most other mainstream databases. By utilizing different Server APIs, PHP can work on many different web servers as a server-side scripting language.

125K
Questions
--
Followers
--
Top Experts
Get a personalized solution from industry experts
Ask the experts
Read over 600 more reviews

TRUSTED BY

IBM logoIntel logoMicrosoft logoUbisoft logoSAP logo
Qualcomm logoCitrix Systems logoWorkday logoErnst & Young logo
High performer badgeUsers love us badge
LinkedIn logoFacebook logoX logoInstagram logoTikTok logoYouTube logo