Welcome Guest, Not a member yet? Register   Sign In
Access same CI code for Sub-Domains
#1

[eluser]Unknown[/eluser]
Hi All,

I am a newbie to CI. My issue is -

I already have a site developed on the CI framework
www.mysite.com
NOW I am supposed to develop
admin.mysite.com
and I want to use the code that I have already in my primary domain (www.mysite.com).


Any ideas will be helpful.

Thanks
Sucheta
#2

[eluser]theprodigy[/eluser]
Are you looking for ALL the code to be accessible (controllers, views, models, libraries, plugins, etc), or just some parts of it?

If you're looking for ALL, the two easiest solutions would be to:
1 - point admin.mysite.com to the same folder that www.mysite.com points to
2 - the index.php file for admin.mysite.com can point to the same application and system folders that the www.mysite.com index.php file points to.

If you're looking for only parts (libraries, plugins, etc), but not all, then the only thing I can think of is to copy the files you want over to the new subdomain. You will end up with two copies, and if you change one, you will have to change the other for consistency sake, but I really can't think of anything else.
#3

[eluser]theprodigy[/eluser]
I thought of another way to take care of accessing only certain files, if you are using a Linux or Unix server and you have command line access (SSH, etc) to the server.

You can create a symbolic link in your admin site application folders pointing to your www site application folders. (ie. if you want access to a "calendar" library, you can go to your application/library folder in your admin site, and create a symbolic link to your www application/library/calendar.php file, and name it with the same name). That way, when you edit your www calendar library, it will also take affect in your admin version since the admin version will be a link (shortcut) to your www file.

I don't believe you can do the same thing with a Windows server as shortcuts act a little differently then symbolic links.

If you want to take this route, you can either google "link, symbolic link" and get some good sites like this one, or find a good book with good references.
#4

[eluser]Unknown[/eluser]
Hey Thanks,

That solves my problem. I wanted to access ALL the files. Also thanks for the second option too ...

Sucheta




Theme © iAndrew 2016 - Forum software by © MyBB