3

I have done some research but have not found something that fits my scenario exactly. I am using Dreamweaver CS5 with PHP files and Dreamweaver alerts me that there is an error in my code with this line:

if(explode("_","some_variable")[0]=="some"){

If I remove the brackets [ ] then the error message goes away making the line be

if(explode("_","some_variable")=="some"){ //never true obviously

I know that I could assign the exploded array to a variable and then call the first value of that variable to remove this code but I was trying to find a solution to be able to write a little more shorthand code.

I found that this method of calling an index is supported from PHP version 5.4 from the answer here: https://stackoverflow.com/a/19408331/1707323 but Dreamweaver still throws error alert. I was able to find out that Dreamweaver CS5 supports code hinting and syntax for PHP version 5.2.

So the main question is: How can I add more support to Dreamweaver CS5 code hinting and syntax checker OR is there a way to ignore certain syntax errors while preserving the rest of the syntax checker?

I know that I could change the line to

if($string = explode("_",$key) && $string[0]=="understand"){

Or I could write a custom function such as the referred answer above suggests, but why write extra code just to satisfy an outdated syntax checker when there might be a way to update the syntax checker.

Note: I am not looking for any answers that involves updating to a newer version of Dreamweaver such as CS5.5 or CS6 as I already have CS5 and do not want to dish out money just for this reason.

Community
  • 1
  • 1
amaster
  • 1,915
  • 5
  • 25
  • 51

2 Answers2

2

The short answer is you can't extend code syntax for CS5. Adobe doesn't support older versions of Dreamweaver and there will not be a patch for it. They want you to upgrade to the latest (subscription-based) version instead.

JCL1178
  • 1,155
  • 1
  • 10
  • 31
  • that is why I really like opensource stuff like notepad++ – amaster Jan 29 '14 at 20:30
  • If you are working in code exclusively, I agree with you 110%. Notepad++, Programmer's Notepad, and Sublime are all fantastic editors. Dreamweaver's visual editor is still probably the best one around so people who need the visual assist still find it valuable. – JCL1178 Jan 29 '14 at 20:43
  • I started in DW purely visual but have since learned code and now only work with code. The only thing that makes it better than notepad++ is how that it automatically shows linked php include and required files and has code hinting for php custom classes from included files. I have yet been able to find this functionality in notepad++. I would make the transition to notepad++ for good if it had this functionality. Any advise? – amaster Jan 30 '14 at 02:41
  • Sublime can do it. http://stackoverflow.com/questions/20209047/can-sublime-text-2-follow-path-in-a-file – JCL1178 Jan 30 '14 at 03:01
2

in dreamweaver cc 2015, your code still alert in the info bar as an error.

dreamweaver use a PHP_KnowledgeEngine.dll (in it's configration folder), it seems this engine is using some source code fron zend engine, but it still cannot correcttly handle this situation.

lovespring
  • 420
  • 1
  • 4
  • 14