The website I am currently programming is one that has a flow I have not exercised before. Therefore, I'm unsure of it's functional and stable integrity. I am hoping others would share their opinions on execution flow.
The execution flow that I have decided to use seems to be functional and stable but I would not be surprised if it presents some sort of issue as the website evolves. Here is the pseudo-code.
index.php
config.php
classes.php
formProcessing.php
header.php, navigation.php, footer.php
control.php
Initially, each php page contained processing code relevant to the page content. However, this led to data inadequacies in the HTML that had already been written. For example, page a.php produces object values that were needed in when the header was processed. Therefore, I changed the flow to execute all processing prior to outputting ANY html.
I hope this conveys my flow well enough. Any comments would be appreciated. Thanks
-Geates
"I hope I can chill and see the change - stop the bleed inside and feel again. Cut the chain of lies you've been feeding my veins; I've got nothing to say to you!"
-Infected Mushroom
"I do not offer answers, only considerations."
- Geates's Disclaimer
The execution flow that I have decided to use seems to be functional and stable but I would not be surprised if it presents some sort of issue as the website evolves. Here is the pseudo-code.
index.php
Code:
//define configuration
if new session include "config.php", else session_start()
//execute ALL php processing
include "classes.php"
include "formProcessing.php";
//HTML
include "header.php"
include "navigation.php"
include "control.php"
include "footer.php"
config.php
Code:
re/initialize session
define $_SESSION vars
establish mysql connection
classes.php
Code:
include "class.a.php"
include "class.b.php"
include "class.c.php"
...
formProcessing.php
Code:
if a form was not submitted, return
if not logged in, return
create class objects used in form processing
which form was submitted? Process the $_POST
update objects that may it (unlikely)
redefine requested page if necessary ($_GET['p'])
header.php, navigation.php, footer.php
Code:
create objects used within HTML
HTML code
control.php
Code:
what page was requested ($_GET['p'])
switch ($_GET['p'])
case a : include "a.php"
case b : include "b.php"
case c : include "c.php"
...
Initially, each php page contained processing code relevant to the page content. However, this led to data inadequacies in the HTML that had already been written. For example, page a.php produces object values that were needed in when the header was processed. Therefore, I changed the flow to execute all processing prior to outputting ANY html.
I hope this conveys my flow well enough. Any comments would be appreciated. Thanks
-Geates
"I hope I can chill and see the change - stop the bleed inside and feel again. Cut the chain of lies you've been feeding my veins; I've got nothing to say to you!"
-Infected Mushroom
"I do not offer answers, only considerations."
- Geates's Disclaimer