Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • EspaƱol
      • FranƧais
      • PortuguĆŖs
  • ę—„ęœ¬čŖžć‚³ćƒŸćƒ„ćƒ‹ćƒ†ć‚£
  • ķ•œźµ­ ģ»¤ė®¤ė‹ˆķ‹°
0

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

Community Beginner ,
Oct 31, 2012 Oct 31, 2012

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?

TOPICS
Server side applications
2.3K
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Mentor ,
Oct 31, 2012 Oct 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.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Nov 01, 2012 Nov 01, 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.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Mentor ,
Nov 01, 2012 Nov 01, 2012
LATEST

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.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Nov 01, 2012 Nov 01, 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.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines