This forum is no longer open and is for reading/searching only.

Please use our new MachForm Community Forum instead.

MachForm Community Forums » MachForm 2

Change prefix tables


  1. Ajaxriver
    Member

    Is it possible to change the default prefix ap_ of tables to another prefix like jos_?

    I need this because joomla.

    Thanks
    JMorais

    Posted 15 years ago #
  2. redityo

    Sorry, I'm afraid it's not possible to change the prefix. All tables are already having ap_xxxx prefix.


    MachForm Support

    Posted 15 years ago #
  3. sphelan
    Member

    Yuniar,

    Table prefixes are an important feature, and is not be a hard change to implement ... I just did this locally in 33 minutes.

    Put these 4 lines at the end of config.php:
    $ap_forms = 'ap_forms';
    $ap_form_elements = 'ap_form_elements';
    $ap_element_options = 'ap_element_options';
    $ap_column_preferences = 'ap_column_preferences';

    Then search/replace across all files, replacing:
    ap_forms => $ap_forms
    ap_form_elements => $ap_form_elements
    ap_element_options => $ap_element_options
    ap_column_preferences => $ap_column_preferences

    Even if you do this globally, it almost works as is . Afterwards, replace:

    function $ap => function ap_

    And you're done.

    Can we get this into the main code base? I'd hate to lose my upgrade path for this one feature.

    Sean Phelan
    http://www.VIRTUssist.com - Secretarial And Virtual Assistant Services

    Posted 14 years ago #
  4. petebocken
    Member

    @Sean - I followed your instructions and I think I'm confused on the last part about "Afterwards, replace function $ap => function ap_"

    Are you doing another search/replace across all files after installation? If you replace $ap with ap_ then you actually will end up with two underscores, so that can't be right.

    Also, isn't the whole idea to be able to install multiple machform installations in one database? So wouldn't you want to customize the 4 lines to say something like "ap_test_forms", etc?

    I tried this. Installation went fine and the tables were created in the database with my custom name but when you go to log in the webpage is white and nothing comes up. Maybe that is because I am missing the last step.

    I tried search/replace across all files and replace $ap with ap_test and then everything works fine, except when you create a new form an ap_form_1 table is added to the database. So isn't the whole point to be able to have a base installation directory that you can just change the config file to a unique database prefix and not have to touch the files since it's automatically looking up the correct prefix in the config file? If that's how it's suppose to work, apparently it's not or I'm doing something wrong.

    Posted 13 years ago #
  5. petebocken
    Member

    So I did another search/replace on all files for the following: ap_form_{$form_id} => ap_test_form_{$form_id}

    Now when I create a new form the database table prefix is correct. So I guess it will work to just do a search/replace on all files every time I want to install a new instance of Machform.

    Posted 13 years ago #

RSS feed for this topic

Reply