Perhaps it's time we revisit the structure of the generated code. Currently, ClassyPHP generates the following:
table_name.inc (the class)
table_name.html (the form)
table_name.php (form submission script)
I suggest for the class in table_name.inc to be divided into a pure class file and a general include file, containing the "EXTERNAL FUNCTIONS" section.
These could then be arranged into the following structure:
Regarding form1.php and form2.php, these files are unusable in an actual project (as they merely contain code for inserting POST data into the database using the class). This code should thus be moved to whatever file the HTML form submits to, which could be quite arbitrary.
Ultimately (if we ever want to go there), a ClassyPHP user could create a project, model the entire project and define a chart of pages and arrows, deciding what pages submit where. In this case, we know exaclty where to put the submission handling code.
But for now...?
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I like this structure. Ive begun creating a page to connect to a mysql database. It tests the connection and also outputs the code it used to try to connect. I have a folder called includes and a file in there called external_functions.php. I gave it a php extension becasue some one could open the .inc file and see the code, or is that the point?
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Perhaps it's time we revisit the structure of the generated code. Currently, ClassyPHP generates the following:
table_name.inc (the class)
table_name.html (the form)
table_name.php (form submission script)
I suggest for the class in table_name.inc to be divided into a pure class file and a general include file, containing the "EXTERNAL FUNCTIONS" section.
These could then be arranged into the following structure:
root/
|-form1.html
|-form2.html
|-form1.php
|-form2.php
|-includes/
| |-external_functions.inc
| |-table_name_1.inc
| |-table_name_2.inc
Regarding form1.php and form2.php, these files are unusable in an actual project (as they merely contain code for inserting POST data into the database using the class). This code should thus be moved to whatever file the HTML form submits to, which could be quite arbitrary.
Ultimately (if we ever want to go there), a ClassyPHP user could create a project, model the entire project and define a chart of pages and arrows, deciding what pages submit where. In this case, we know exaclty where to put the submission handling code.
But for now...?
I like this structure. Ive begun creating a page to connect to a mysql database. It tests the connection and also outputs the code it used to try to connect. I have a folder called includes and a file in there called external_functions.php. I gave it a php extension becasue some one could open the .inc file and see the code, or is that the point?