Results 1 to 7 of 7
  1. #1
    Join Date
    Nov 2006
    Location
    New York City
    Posts
    248
    Plugin Contributions
    1

    Default 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!

  2. #2
    Join Date
    Jan 2004
    Posts
    59,807
    Blog Entries
    4
    Plugin Contributions
    133

    Default 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.
    .

    Zen Cart - putting the dream of business ownership within reach of anyone!
    Donations always welcome: www.zen-cart.com/donate

    Remember: Any code suggestions you see here are merely suggestions. You assume full responsibility for your use of any such suggestions, including any impact ANY alterations you make to your site may have on your PCI compliance.
    Furthermore, any advice you see here about PCI matters is merely an opinion, and should not be relied upon as "official". Official PCI information should be obtained from the PCI Security Council directly or from one of their authorized Assessors.

  3. #3
    Join Date
    Nov 2006
    Location
    New York City
    Posts
    248
    Plugin Contributions
    1

    Default Re: Extra Configures file will not load configuration key values

    Quote Originally Posted by DrByte View Post
    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
    Last edited by DrByte; 6 Apr 2008 at 09:56 PM. Reason: removed attachment, in favor of link to document location

  4. #4
    Join Date
    Jan 2004
    Posts
    59,807
    Blog Entries
    4
    Plugin Contributions
    133

    Default 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
    .

    Zen Cart - putting the dream of business ownership within reach of anyone!
    Donations always welcome: www.zen-cart.com/donate

    Remember: Any code suggestions you see here are merely suggestions. You assume full responsibility for your use of any such suggestions, including any impact ANY alterations you make to your site may have on your PCI compliance.
    Furthermore, any advice you see here about PCI matters is merely an opinion, and should not be relied upon as "official". Official PCI information should be obtained from the PCI Security Council directly or from one of their authorized Assessors.

  5. #5
    Join Date
    Nov 2006
    Location
    New York City
    Posts
    248
    Plugin Contributions
    1

    Default Re: Extra Configures file will not load configuration key values

    Quote Originally Posted by DrByte View Post
    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.

    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..

  6. #6
    Join Date
    Jan 2004
    Posts
    59,807
    Blog Entries
    4
    Plugin Contributions
    133

    Default Re: Extra Configures file will not load configuration key values

    Similar infrastructure exists on the admin side.
    .

    Zen Cart - putting the dream of business ownership within reach of anyone!
    Donations always welcome: www.zen-cart.com/donate

    Remember: Any code suggestions you see here are merely suggestions. You assume full responsibility for your use of any such suggestions, including any impact ANY alterations you make to your site may have on your PCI compliance.
    Furthermore, any advice you see here about PCI matters is merely an opinion, and should not be relied upon as "official". Official PCI information should be obtained from the PCI Security Council directly or from one of their authorized Assessors.

  7. #7
    Join Date
    Nov 2006
    Location
    New York City
    Posts
    248
    Plugin Contributions
    1

    Default Re: Extra Configures file will not load configuration key values

    Thanks so much! That was really a great help!

 

 

Similar Threads

  1. Why won't Flash using XML file load images?
    By wasana in forum Templates, Stylesheets, Page Layout
    Replies: 30
    Last Post: 2 Dec 2010, 07:13 PM
  2. Load a js file on ANY page under certain condition?
    By yellow1912 in forum Contribution-Writing Guidelines
    Replies: 2
    Last Post: 1 Apr 2008, 07:11 PM
  3. Attribute File - Update value on page load...
    By Alex Clarke in forum General Questions
    Replies: 4
    Last Post: 29 Sep 2007, 11:51 AM
  4. Replies: 5
    Last Post: 15 Jan 2007, 06:23 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •