Welcome Guest, Not a member yet? Register   Sign In
2 Websites, 2 Domains, Same codebase
#6

[eluser]pickupman[/eluser]
[quote author="JanDoToDo" date="1274106140"]Ok.. thanks for that. Another point - If I have different users for different domains then (based on the users have an auto incremented id) the user ids would overlap as the user ids would conflict between the two databases. Also, if I was selecting a user based on their use id, I would not know from which database to get it from. Alternatively, I could just one one database with a column for which domain the user is from but that doesnt seem as good as having separate db/tables? how would you go about this?[/quote]
I guess I am confused, because you mentioned you would be using separate databases, but sharing views. If you are looking to use the same user table, but have different data tables, how about a table prefix. (site1_pages, site2_pages). Use one database, can call your table names dynamically.
Code:
class Pages_model extends Model{

var $site;

public function __construct(){
    $this->site = $_SERVER['HTTP_HOST'];
}

public function get_pages(){
   $query = $this->db->get($this->site.'_pages'); //get site1.com_pages
}
}

You would probably want to extract part of the domain name using explode() or something rather than the whole domain name for a table prefix.


Messages In This Thread
2 Websites, 2 Domains, Same codebase - by El Forum - 05-15-2010, 08:23 AM
2 Websites, 2 Domains, Same codebase - by El Forum - 05-15-2010, 08:33 PM
2 Websites, 2 Domains, Same codebase - by El Forum - 05-16-2010, 12:29 AM
2 Websites, 2 Domains, Same codebase - by El Forum - 05-16-2010, 06:53 AM
2 Websites, 2 Domains, Same codebase - by El Forum - 05-17-2010, 03:22 AM
2 Websites, 2 Domains, Same codebase - by El Forum - 05-17-2010, 07:28 AM
2 Websites, 2 Domains, Same codebase - by El Forum - 05-17-2010, 07:44 AM
2 Websites, 2 Domains, Same codebase - by El Forum - 05-17-2010, 08:39 AM
2 Websites, 2 Domains, Same codebase - by El Forum - 05-17-2010, 05:20 PM



Theme © iAndrew 2016 - Forum software by © MyBB