There's a number of issues here in this code - I get the feeling you're not really understanding what you're doing or why you're doing it, and instead are just throwing some code into the module and hoping it works?
Your second view function is useless - remove it. The first one has issues but the basic idea is:
function view_myCustomModule_default($_post, $_user, $_conf)
{
switch ($_post['option']) {
case 'my-custom-module-page-houston':
case 'my-custom-module-page-chicago':
case 'my-custom-module-page-new-york':
$_data = jrCore_db_get_item_by_key('myCustomModule', 'mod_page', $_post['option']);
if (!$_data || !is_array($_data)) {
$_data = array('mod_page' => $_post['option']);
jrCore_db_create_item('myCustomModule', $_data);
}
return jrCore_parse_template('my-custom-module-page.tpl', $_data, 'myCustomModule');
break;
}
}
What I added is:
- try to get the EXISTING page entry into $_data using jrCore_db_get_item_by_key
- if it does not exist, create it
Note I used "mod_page" here since I have no idea what your DS prefix is, but you will need to change that to be whatever your module prefix is.
This is really as far as we can take coding this for you in the forum - I'd HIGHLY recommend that you spend some time learning PHP development so you know what the code you are putting in the file actually means, etc. You want to be careful and know exactly what (and why) you are doing it, since doing it wrong could mess your site up or expose a security issue.
--
Brian Johnson
Founder and Lead Developer - Jamroom
https://www.jamroom.net