Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 616
  • Last Modified:

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.
0
janmishkin
Asked:
janmishkin
  • 6
  • 5
  • 5
  • +3
1 Solution
 
Marco GasiFreelancerCommented:
www.netbeans.org: it's really the best ide for php and it is free!
0
 
twohawksCommented:
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

;^)
0
 
Hugh McCurdyCommented:
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/
0
Get your Disaster Recovery as a Service basics

Disaster Recovery as a Service is one go-to solution that revolutionizes DR planning. Implementing DRaaS could be an efficient process, easily accessible to non-DR experts. Learn about monitoring, testing, executing failovers and failbacks to ensure a "healthy" DR environment.

 
Jason C. LevineNo oneCommented:
If you switch to Code View in Dreamweaver and select "highlight invalid code" it should also pick it up...
0
 
twohawksCommented:
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.
0
 
Hugh McCurdyCommented:
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.  
0
 
Lukasz ChmielewskiCommented:
Eclipse with aptana studio plugin. Definetely. Code autocomplete / syntax highlight / many more.
http://www.eclipse.org/projects/project.php?id=tools.pdt
0
 
janmishkinAuthor Commented:
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.
0
 
Marco GasiFreelancerCommented:
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.
0
 
janmishkinAuthor Commented:
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.
0
 
Marco GasiFreelancerCommented:
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
0
 
Jason C. LevineNo oneCommented:
>> 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.
0
 
janmishkinAuthor Commented:
So I should have the 2nd one checked, yes?
0
 
janmishkinAuthor Commented:
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!!!
0
 
Hugh McCurdyCommented:
@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?
0
 
Marco GasiFreelancerCommented:
@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
0
 
janmishkinAuthor Commented:
Thank you both; due to the holiday of Yom Kippur I will not be able to work on this until Monday.  Stay tuned!
0
 
twohawksCommented:
When you come back, will yo uplease answer the question marqusG raises so we can put that to bed ;^)

Happy Yom Kippur
0
 
Marco GasiFreelancerCommented:
@twohawks: I didn't know to have raised a question...
0
 
twohawksCommented:
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.
0
 
Hugh McCurdyCommented:
twohawk, pencils have erasers.  (No problem)  Jan should be back on Monday.  Don't know which time zone though...
0
 
janmishkinAuthor Commented:
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.
0
 
Hugh McCurdyCommented:
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.)

0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

  • 6
  • 5
  • 5
  • +3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now