Multiple sites with 1 kohana core on same server - php

I think it has to be possible, but didn't find anything useful yet...
Is it possible to run multiple websites with from 1 Kohana core? Basically all website's are the same, only the layout is different. (Just a different view-folder, (works)) and the content is a bit different. (This is based on constant SITE_ID that pulls it from the db, (also works))
The only two things are, how do I configure this in my bootstrap/index.php? I thought of checking the url. With that url perform a query on the table 'websites' (select where url = '$url') and get the right SITE_ID and view from that query.
In that way both x.com y.com and z.com will pull up the same index.php file. After that SITE_ID is defined and with that id the right content is loaded and the right view is used.
Also, how can I do this in combination with widgets. I have like 8 different widgets and each website displays 3 of those 8 over different pages. So x.com/a will display widget 'widget_1' and 'widget_2', x.com/b will display 'widget_2' and 'widget_3'. But y.com/a has to display 'widget_6' and 'widget_7' and y.com/b has to display 'widget_3' and 'widget_4'.
Is there a way this can be managed? I didn't worked a lot with widgets before and now I want to use it in combination with multiple sites...
Possible?

For multiple sites handled via database within a single instance; what you're doing is similar to a multisite CMS. I have experience developing CMSes, both of the single site and multisite sort; I can tell you through experience that developing a multisite CMS is significantly more complex than doing multiple instances of single CMS. I usually opt for the latter if having multisite is not a requirement from the client and the implementation is up to me.
Have you considered multiple instances of websites with separate folders?
For multiple instances of single sites, I suggest reading http://kohanaframework.org/3.2/guide/kohana/tutorials/sharing-kohana to get a better idea of how do go about having multiple sites with single (or even multiple core).

Related

Splitting One Big WordPress Site into Multiple Small Sites

I have a very big WordPress site and I am facing speed issue and server resources issues. Specially numbers of MySQL records are so high. So, I want to split the big WordPress site into multiple small sites.
I have URL structure like this
http://siteurl.com/this-is-first-post.html (category1)
http://siteurl.com/this-is-second-post.html (category2)
http://siteurl.com/this-is-third-post.html (category1 and category2)
I want to separate the WordPress according to category, I am thinking about two solutions
Either I create two DBs for each categories, e.g. db_cat1 and db_cat2 and I divide the data using some logic.
Or I create subdomains and install different WP instances like this:
http://category1.siteurl.com/this-is-first-post.html
http://category2.siteurl.com/this-is-second-post.html
My questions are:
If I try the first logic, then how can I divide the databases into different categories db?
If I try second logic, then how can I manage the URL structure and keep SEO juice there? How can I divide the common tags and categories?
How I will manage resources such as image etc after splitting the WordPress?
Is there any better way to do this job?
I don't want change the server or work on server because I already tried different types of server and all servers have the MySQL resources issues. I prefer second logic because it is easy to handle.

How to store strings in apps that are 100% equals except the database and the strings?

I'm working in some php web apps that are almost identic, except content database, texts, and themes. Let's think in some similar like could be stackexchange sites.
The objective is mantain only one project in the same repository, so if I introduce a new feature, I only have to implement once, and not for every site.
For the themes and database is not a problem, but for the texts I don't know how can I proceed (now the texts are hardcoded in the php files).
I've googled and searched in SO, and I've find some questions similars like this where the answer was using gettext for i18n.
But in my case, it's not exactly i18n, because some of the sites are in the same language but the texts are different.
How can I store these strings?
There are tons of ways to get this done. I have a fitting project-scenario where I archive different things in different ways:
All instances of a project come from the same SVN folder.
Each instance has its own config-file, which is not included in SVN.
In addition to that, every project has its own:
Textbase (Labels, etc)
Templateset
Content
I use my own translation-system to distribute the textbase over my instances. You can use some of php's build in functions: http://verens.com/2008/04/03/translation-in-php/
The Templateset is just done by a config-variable that sets the root directory for the template-engine: ./templates/instance-x/...
The content could also referenced by a config-variable. In my case, I have a shop-system, that uses a product-base, which is used by all instances identically. To make a product available/visible to the public, you have to assign it to a category. Categories and instance-dependent.
Categories got a instance-specific ID (in my case its the shop_id).
You could for example create a table called "texts" in each database that contains the specific texts for that app. As you already have to connect with a different database for each app, you can easily implement to always get SELECT value FROM {current_database}.texts WHERE key = "headertext" or so.
That way, your code can stay the same and only the databases differ from each other.
UPDATE: And of course i18n localization is also easily implemented this way, by adding another column to the texts table containing the localization value (like en, de or nl etc.)

Creating multilingual wordpress site with shared structure and php functions

I know there are many multilingual wp plugins but I'm not sure which method should I use for this purpose;
I'd like to create a wp site with advanced features, partly coded by myself in php. Then I generally want to create duplicates of this site's structure, design and behavior in other languages, for example, es.blog.com would be a duplicate of en.blog.com. The content, however, shouldn't be shared.
I'd also like to keep changing the code only at one place and make those changes affect all the other languages duplicates, so I assume that means the code itself, or parts of it, would be shared.
Is there a way to have a shared structure, design and functions for several blogs, while the content of each blog is different?
I believe this is a perfect case for WordPress Multisite.
Multilingual Network (forum thread)
I would like for users to choose their language when they first get to the site - so they can choose to read, register, administer the entire site (front end and back) in either English, Kurdish (and perhaps others).
How to set a bilingual or multilingual WordPress multisite blog (blog post)
I need two independent sites to facilitate the plugins and theme localization with an easy way to switch between languages if a translation is available. Another reason is to optimize the search engine indexing. With this solution I can have some language specific posts without translation.
[ update ]
Multilingual Press (plugin)
Each site/blog can then be attributed to a different language. Simply write a post or page in one language and Multilingual-Press will automatically create a duplication of it in the other sites/blogs. These new posts and pages are interlinked and are easily accessible via the post/page editor screen - you can switch back and forth to translate them! Multilingual-Press is WordPress conform, easy to install and doesn't make any changes to the WordPress core. It doesn't harm your website's performance.
You could use any MVC framework to achieve this, and simply store the data in a database with a 'language' field and call only rows from that language.
Google 'MVC Framework'.
A good and free example would be CodeIgniter.
In CodeIgniter, you can include the Wordpress files in your 'libraries' folder then create a model with the specific functions you need to use.
Finally, you would have to create an .HTACCESS file to get the sub-domain section from the URL if you were to use this approach, however, again, there are many tutorials on achieving this, google 'htaccess URL rewrite'
I wouldn't recommend WP for any true multilingual site, searches get messed up, plugin-incompability etc.
Install parallell WP-instances in subdirs and make one the "master" for dev/bugfixes. Content is isolated and you can use standard WP-features without metadata or plugin-hacks.
By "changing the code", I presume you mean the template? It's a simple drag'n'drop in a decent ftp-client.

Multiple Joomla websites with in One installation and database

Is it possible(out of the box) to have multiple website running on one Joomla installation.
The idea is to give clients a unique domain(or sub domain) and based on the request coming from a particular domain the view should be assembled (theme selection, articles, pages)..
Is it possible.. ??
It important that for each domain we should have a unique theme.
I am not particular about Joomla..If the same is possible with ease in any other CMS like Drupal,etc then please share your thoughts about the same.
Thanks in advance
In Drupal this is called "multisites" and it's easy to have each site have its own theme and/or even have additional modules used only on some sites, but all sites generally using the same Drupal installation. Anyway, what you describe is commonly done in Drupal and not too hard to accomplish.
More info here: http://drupal.org/documentation/install/multi-site
i am not sure about installation, but you can store all the data into a single database, but keep in mind that it is possible with multiple prefixes,
means like you have two joomla sites one with 'jos_' prefix(by default joomla prefix, you can change this) and the other with different prefix

Serving multiple site with one drupal (not using multi site)

I am looking for expert advice on how to best serve multiple sites with one Drupal instance (using Pressflow 6.x). Let's consider the company needing this is called "ABC Group of Companies" and it has 3 sister concerns. So, altogether there will be four sites:
www.abcgroup.com
www.company-a.com
www.company-b.com
www.company-c.com
Here are the things that are most interesting:
The users will be shared among all
the sites
Each site will "mostly" host their own content (say the welcome text on home page, or menu items - different for each site)
Some contents, will be shown in all of the sites (say, a company-wide notice....or an employee directory)
The theme for each site will be different
Now, I am thinking of having DNS entry so each of the domain point to the same Drupal installation and when Drupal gets bootstrapped, I would like to sniff into the $_SERVER array to know which site is being hit. I'd then like to load the theme accordingly, show the contents specific to that site, and also show the contents that are shared with all the sites.
To make this happen, so far I have created a node type called "Site" and have created four contents for each of the sites. Then for each other content type (say, Page) I have put a node reference to the "Site" content type with multiple value so when creating a new content, the administrator can specify in which site that content will be showed. However, after that I am stuck.
I have tried to understand Contexts, Spaces, PURL - but haven't figured them out fully yet and I believe I could use the community power to help me out. What do you think is the best approach to handle this scenario ?
It'd be greatly helpful if anybody can suggest a direction.
Regards,
Emran
The way you are suggesting is certainly a way that you could do it, but have you considered domain access? I have used it in the past and found it to be very useful. there is also quite a large collection of modules which work with it. Different themes, Options as to which nodes should appear on which sites and shared users are all features that it has.
Hope this helps!
http://drupal.org/project/domain
First up, I strongly second hookds suggestion of using Domain Access Module for this (+1). It has extensive support/features for your scenario and already covers most of the hard parts you'd need to solve yourself otherwise.
Second, if you insist on trying to do this yourself, I can assure you that it is possible, as we have done something pretty similar recently (some special requirements ruled out domain access), but it was a lot of work, especially when functionality provided by contributed modules would not fit well into our 'unusual' scenario.
Given the multitude of special cases you'd have to cover, it is hard to point out a general direction (apart from suggesting to use Domain Access Module ;) but one major point would be to check out the custom_url_rewrite_inbound()/custom_url_rewrite_outbound() function combo. These will allow you to do pretty low level URL manipulations for incoming requests, as well as for URLs generated for output, both of which you'll need to do if you you want to serve multiple domains from the same instance.
Did I mention that you should check out Domain Access Module before you try to build this yourself?
It sounds like there will be virtually no content shared between these sites. Will you be wanting a single login across all sites?
Remember, Domain Access uses 1 shared database.
You could also just do a regular multi-site install, and share certain tables.
I give Domain Access two thumbs up, but just make sure you really need what it actually does.
Also, I would look into the Feeds.module. You can pull content from anywhere (especially another drupal site) and it imports it directly and creates nodes and fields automatically from it.

Categories