Blocksbox
09 Jun 2010, 07:34 PM
Greetings. Let me start off by mentioning that I am in no way a professional web developer. I have never worked for a company whose primary function was web design/development, nor have I ever completed training be it collegiate or otherwise on the subject. With that said, I do have a solid foundation rooted in XHTML, CSS, PHP, and MySQL databases from years of personal interest and hobbying. From a technical standpoint I am capable of coding my current project, but I lack a lot of the formal finesse you get from structured learning.
What I am curious about is the way most web developers approach creating a site using PHP and MySQL databases for modularity. Up until now I have only used the two when it was convenient for me, doing things like getting a sort type from the url (IE: page.php?uname=asc) and then using it to pull a table of data in said order. I also make use of includes where I feel they are appropriate. What I hope to learn is the set of standards frequently used by professionals. Specifically:
1) Where are main included files (navigation, etc.) usually stored? Is a /includes directory made similar to /images, or are they placed in root?
2) Say I have a file in /dir_a that uses a relative include like "../nav.php". Later I restructure the site and move the file into /dir_a/child_b. Now the include will be looking for nav.php in dir_a. How do I overcome this problem? Do I use only absolute links? Do I simply keep all of my main pages in root to dodge the problem altogether?
3) With the power of CSS to position div elements wherever, what is the advantage of including a header, nav bar, footer, etc. instead of just creating one include and positioning all of the elements afterward?
4) Is establishing a connection to a MySQL database via a file that is included safe? Is it the way connections are normally handled in case database information changes? If so, is it given its own include file so that it is only called when necessary, or is it placed within a different include like the header?
5) Just generally speaking, how is a PHP<->MySQL driven site laid out from a structural standpoint?
Does anyone have a link to any references that cover these topics and similar concepts? Does anyone just happen to know the answers outright? Any help on the matter would be greatly appreciated. I am finding it much more difficult to search for this type of information versus searching for technical information.
What I am curious about is the way most web developers approach creating a site using PHP and MySQL databases for modularity. Up until now I have only used the two when it was convenient for me, doing things like getting a sort type from the url (IE: page.php?uname=asc) and then using it to pull a table of data in said order. I also make use of includes where I feel they are appropriate. What I hope to learn is the set of standards frequently used by professionals. Specifically:
1) Where are main included files (navigation, etc.) usually stored? Is a /includes directory made similar to /images, or are they placed in root?
2) Say I have a file in /dir_a that uses a relative include like "../nav.php". Later I restructure the site and move the file into /dir_a/child_b. Now the include will be looking for nav.php in dir_a. How do I overcome this problem? Do I use only absolute links? Do I simply keep all of my main pages in root to dodge the problem altogether?
3) With the power of CSS to position div elements wherever, what is the advantage of including a header, nav bar, footer, etc. instead of just creating one include and positioning all of the elements afterward?
4) Is establishing a connection to a MySQL database via a file that is included safe? Is it the way connections are normally handled in case database information changes? If so, is it given its own include file so that it is only called when necessary, or is it placed within a different include like the header?
5) Just generally speaking, how is a PHP<->MySQL driven site laid out from a structural standpoint?
Does anyone have a link to any references that cover these topics and similar concepts? Does anyone just happen to know the answers outright? Any help on the matter would be greatly appreciated. I am finding it much more difficult to search for this type of information versus searching for technical information.