Lets take a look at my code snipet first.
Code: Select all
$pages = array('employees' => '/admin/content/employees.php',
'emp-add' => '/admin/content/emp-add.php',
'emp-added' => '/admin/content/emp-added.php',
'emp-update' => '/admin/content/emp-update.php',
'emp-updated' => '/admin/content/emp-updated.php',
'emp-delete' => '/admin/content/emp-delete.php',
'emp-deleted' => '/admin/content/emp-deleted.php',
'emp-view' => '/admin/content/emp-view.php',
'punch-add' => '/admin/content/punch-add.php',
'punch-added' => '/admin/content/punch-added.php',
'punch-update' => '/admin/content/punch-update.php',
'punch-updated' => '/admin/content/punch-updated.php',
'punch-delete' => '/admin/content/punch-delete.php',
'punch-deleted' => '/admin/content/punch-deleted.php',
'user-add' => '/admin/content/user-add.php',
'user-added' => '/admin/content/user-added.php',
'login' => '/admin/content/login.php',
'logout' => '/admin/content/logout.php',
'login-failed' => '/admin/content/login-failed.php',
'user-add' => '/admin/content/register-form.php',
'user-added' => '/admin/content/register-success.php',
);For instance index.php?nav=user-add would bring up the /admin/content/register-form.php inside my formated index page. Fairly simple code to edit and modify. However here comes my issue. I want to use if statements. My project is to create a modular based website, and instead of adding all th possible page links, I want to include files if the exist. The above segment is for employee and time punches, the basis of my program. I want to add a module for payroll, so I want to figure out how to create an include that has just the payroll array info, something like below
Code: Select all
'payroll-admin' => '/admin/content/payroll-admin.php',
'payroll-payout' => '/admin/content/payroll-payout.php',
'payroll-search' => '/admin/content/payroll-search.php',
'payroll-view' => '/admin/content/payroll-view.php',I was looking at the array_merge() function, but again using it with if statements looks impossible.
Does anyone know of a way that I can append my pages array? SO that if it exists, I can inject these lines into the pages array.
I hope I explained it properly. Let me know if you don't understand and I will try and explain it a little better understand.