2 sites 1 database

I am trying to make my page using OCS to be mobile friendly, so I inject into index.php a piece of code to redirect into a subfolder when it detects Mobile OS. So now what can I do to make it use the same data with my desktop site? Is setting the same database and folder for uploaded files enough?

I guess it is, but I would think that doing this just with a custom theme and css rules for different screen sizes would be easier?