Extra Configures file will not load configuration key values
Hello,
I am working on fixing up a PHPList mod, and one of the things i'm working on is to create functionality to be able to configure settings from within the Admin. However, for whatever reason, the auto-loading file that resides in the includes/extra_configures folder will not translate the configuration key (as set in the database) to the actual value. I can, however, echo the value of the key out on other pages on my site.
Here is a snippit of code from that file in the extra_configures folder - "ADMIN_VALUE_PHPLIST_DB" used to be filled in with a string with the database name written in and i'm trying to code this so the value is actually kept in the database in the Configurations table so it can be updated via the admin.
Code:
define('PHPLIST_DB', ADMIN_VALUE_PHPLIST_DB); //the name of the phplist database if same as Zen Cart, leave blank
The file is filled with other defines just like that and opening and closing PHP tags. And nothing else. Maybe i am missing an include/require? I can't figure it out... Any help is greatly appreciated!!
Thanks! :smile:
Re: Extra Configures file will not load configuration key values
You're trying to put this in the wrong location in terms of order of program execution. The extra-configures files are processed way before the database is even opened, let alone having any of the configuration keys loaded.
Re: Extra Configures file will not load configuration key values
Quote:
Originally Posted by
DrByte
You're trying to put this in the wrong location in terms of order of program execution. The extra-configures files are processed way before the database is even opened, let alone having any of the configuration keys loaded.
I have found the Zen Cart program flow (i attached it to my response here in case any one else is reads this and can use it), and unfortunately i still need a nudge in the right direction.
The contribution i'm updating is coded to use the extra-configures file to set config options. I have been studying the flow chart, but cannot figure out what i need to do with this so that i can reference the configuration keys from the database. Can i simply drop the file somewhere else that so that it can define these values early on and get the database keys? Just a little confused here, and i'm having a hard time figuring it out based on what other contributions do...
Document: http://www.zen-cart.com/index.php?ma...roducts_id=378
Re: Extra Configures file will not load configuration key values
There are a few ways.
Perhaps using the initSystem would suit best.
You can hook into the initSystem by:
1. Rename your /includes/extra_configures/xxxxx.php file to:
/includes/init_includes/my_init_phplist.php
2. Create a new file: /includes/auto_loader/config.myphplistsettings.php
with this content:
Code:
<?php
$autoLoadConfig[200][] = array('autoType'=>'init_script',
'loadFile'=> 'my_init_phplist.php');
?>
http://www.zen-cart.com/wiki/index.p..._API_Tutorials
Re: Extra Configures file will not load configuration key values
Quote:
Originally Posted by
DrByte
There are a few ways.
Perhaps using the initSystem would suit best.
You can hook into the initSystem by:
1. Rename your
/includes/extra_configures/xxxxx.php file to:
/includes/init_includes/my_init_phplist.php
2. Create a new file:
/includes/auto_loader/config.myphplistsettings.php
with this content:
Code:
<?php
$autoLoadConfig[200][] = array('autoType'=>'init_script',
'loadFile'=> 'my_init_phplist.php');
?>
http://www.zen-cart.com/wiki/index.p..._API_Tutorials
Oh that worked like a charm. :D
Is there anything i should be aware of if i do that same process on the admin side? I have a similar situation over there too..
Re: Extra Configures file will not load configuration key values
Similar infrastructure exists on the admin side.
Re: Extra Configures file will not load configuration key values
Thanks so much! That was really a great help! :D