Mailinglist – php example code – part 6 – further small improvements
Article focus on small code improvements that can be extended by time. Our firs improvement is separation of database access constants into a appvars.php file. This file is included into a main code with require_once(); PHP function.
Better maintainability of of code is gained by separating all constants on one place. Then they can be invoked by include or require_once() PHP function. For further reading about diferences between these function, please visit as example this page.
File with defined constants, in our case database server access parameters is implemented in all .php files with require_once() statement.
Next photo show content of mentioned file.
Example of changed parts of other pages follow.
Full application code of mailinglist can be obtained from github here.