Can dbprefix be applied to fuel admin tables?

edited October 2011 in Feature Requests
I've used a Codeigniter setup example where multiple application folders can be accessed according to host name, on a fresh FuelCMS install. This works fine I think for the application folders, but I'd like just 1 instance of the Fuel admin module to also respect the dbprefix value, so that there might be tables like a0_fuel_pages, b0_fuel_pages, c0_fuel_pages that are also accessed per host name. This seems feasible, but the admin clearly doesn't use the prefixes consistently. Where could this be effected and how? Would it be easier to use different databases, rather than prefixed tables, to achieve the same end? Or would I need to replicate the Fuel module itself (making the entire endeavour a bit pointless). My aim is to manage 5 sites with one codebase, and naturally, one admin should be able to cope with everything.

Comments

  • edited October 2011
    I should qualify the above, the admin system doesn't seem to consistetly use prefixes! For example, an error like:

    Error Number: 1054

    Unknown column 'fuel_users.first_name' in 'field list'

    SELECT sm_fuel_blog_posts.id, title, CONCAT(fuel_users.first_name, " ", sm_fuel_users.last_name) AS author, sm_fuel_blog_posts.date_added, sm_fuel_blog_posts.published FROM (sm_fuel_blog_posts) LEFT JOIN sm_fuel_users ON sm_fuel_users.id = sm_fuel_blog_posts.author_id ORDER BY date_added desc

    demonstrates that the prefix ('sm_') is being used in the early part of the select for blog_posts, but not in the CONCAT function for users.first_name, but is for users.last_name, although all columns are ultimately resolved by _tables[]. The error is from blog_posts_model.php.
  • edited 12:32PM
    I think it would be easier to create different databases for each one. You could dynamically set the database config values based on the domain or some other site specific variable. You wouldn't need to touch anything in the FUEL modules folder, just the applications folder for each site. To what extent depends on how much programming you do for each site (e.g. view files, controllers, etc).
  • edited October 2011
    Thanks for the quick response! Yes, I can see the database solution would work much better. I went down the dbprefix route because I thought it might be more "economical" when (and where) hosted. I'm still curious why the prefix angle nearly works, but fails at various CRUD routines in the admin, but only on one or two columns it seems (as per the blog post example earlier). Still, I can move ahead now. I'm really enjoying FuelCMS by the way - great work! I've tried about 2 dozen PHP frameworks, and CI + FuelCMS just seems native somehow!
  • edited 12:32PM
    Glad you are finding FUEL useful. I've added the db prefix to the list of things to look into.
Sign In or Register to comment.