Hi, When we are going to refactor the huge php file which contains mix of html tags and php code like server_privileges.php script. And html tags are printed by php in this script, what is the best way to refactor. I somewhat confused about that. Is it good to separate html and php tags and implement several functions? I like to see the suggestions.
Le 2012-03-31 14:03, Thilina Buddika Abeyrathna a écrit :
Hi, When we are going to refactor the huge php file which contains mix of html tags and php code like server_privileges.php script. And html tags are printed by php in this script, what is the best way to refactor. I somewhat confused about that. Is it good to separate html and php tags and implement several functions? I like to see the suggestions.
In the roadmap for version 4.0 [0], we indicate this: "The current <html> and <?php> mix will be cleaned up in the process. The <html> output will be moved to lib/include files which can be called by either the index page or by the specific files (which can still be referenced seperately)."
The exact method to achieve this separation has not been chosen, but indeed, refactoring usually produces code having more, smaller functions.
Look at this example: [1].
[0] http://wiki.phpmyadmin.net/pma/FOSDEM_2012_Meeting
[1] https://github.com/phpmyadmin/phpmyadmin/commit/1394cc65e8bb3b5218ffb83dd3cb...