Skip to main content
Participant
October 31, 2012
Question

Can I edit Dreamweaver's PHP generated code???

  • October 31, 2012
  • 2 replies
  • 2312 views

Hi, I'm currently using Dreamweaver CS5.5 and I 'd like some information about the PHP code that Dw generates, 'cause I find it a little bit confusing and find it a little bit difficult to understand.

1st. About the Authorization or the  login script that dw generates. Do I have to sanitize the given username or encrypt/hash the password  before doing the check with the ones that are in database, or Dreamweaver does already this for me? If I have to do it by myself where exactly can I apply my own code?

2nd. When creating a query from the bindings, Dreamweaver also generates a GetSQLValueString function which, to tell the truth, confuses me a lot. If I remove this code completely, and keep only the query( or queries in case i want to have more than one), will this have any effect on the rest functionality of the page? Or what if I put it in a seperate file and inlude it in the pages i want to?

3rd. I've also noticed that creates some folders like _mmServerScripts, _notes in the site. Is it also ok if I delete them from the site, or will have an effect on my code?

And one last thing. When I sometimes type an if statement like this:

<?php if(condtition): ?>

<p>Hello</p>

<?php endif; ?>

I get the syntax error highlight. Is this somekind of bug?

This topic has been closed for replies.

2 replies

Participating Frequently
November 1, 2012

>If I remove this code completely, and keep only the query( or queries in case i want to have more than one),

>will this have any effect on the rest functionality of the page?

The GetSQLValueString, used along with sprintf(), is used to prevent SQL injection. As long as you are taking steps to avoid sql injection you don't need to keep DW generated code.

Rob Hecker2
Legend
October 31, 2012

I have never used code generated by DW, and never will. Much better to write your own code and organize it in ways that make sense for your project.

#3 - There is nothing wrong with your code here, unless there is something wrong with your condidtion, however you can't use the very useful balance braces feature if you use that construct.

Lykos22Author
Participant
November 1, 2012

Thanks for the reply. Personaly i use Dw more for the html and css structure, I haven't used the php code that generates till now, I thought i should give a try, and as I was just wondering whether I'm going to have any problems with all that I 've mentioned, I thought  I should ask first in case someone knows.

Rob Hecker2
Legend
November 1, 2012

Since you are starting out and trying to make a decision regarding DW generated code, here's my thought:

DW doesn't write PHP the way people write it. As your skills improve and your projects become more complex, the DW code approach will becoming increasingly a liability. So why start out with a bad approach. Better to write your own code from the start so your code-writing skills will mature.

Some books and online tutorials teach out-dated or lousy coding approaches. The David Powers books teach good skills and apply current methods.

DW does have helpful tools for writing PHP-- syntax checking and balance braces.

As your coding skills develop, you will accumulate a collection of complex  functions, classes, and code snippets that you can plug into new projects. Also, eventually you get to the point where you can write PHP just as quickly as you can HTML -- but you will never get to that point if you rely on DW-generated code.