Come together with the global Drupal community in Rotterdam, 28 Sept – 1 Oct 2026. Sessions, contribution, connection, and Early Bird savings until 8 June.
Drupal doesn't store information about other sites on the same codebase, but assuming you have the standard structure, you could look at the site names in the sites directory.
etc, if you can grab those folder names, should give you the other sites in the install. not really a good idea though, so im open to better suggestions :P.
if i get a chance will post the actual code for doing that in a bit
Comments
Use the site_name variable
Like this:
variable_get('site_name', "Default site name")
Ehmmm... and for the site url? :)
Hi,
I'm using Drupal 6.x and I'm searching for the website URL to use in an email notification.
I searched for it in the variables table of my database... I found site_name for the textual name of the website... but if I need the base URL?
Thank you for you help...
PhAI
Superglobal _SERVER
Would
$_SERVER['SERVER_NAME']work for you?Thanks
It works, but I prefer to not use server_name on a multidomain website...
However... thank for your suggestion... ;)
$base_url
I know this is an old thread but I think it's better to use
$base_url;Make sure u get it global before using it:
Freelance Drupal developer, contact me if you want help on your Drupal project.
Thanks! $base_url was
Thanks!
$base_urlwas exactly what I needed!Multisite
What about if it is a multisite and I need all the list of sites?
Drupal doesn't store
Drupal doesn't store information about other sites on the same codebase, but assuming you have the standard structure, you could look at the site names in the sites directory.
i.e.
sites/site1.com
sites/site2.com
sites/dev.site2.com
etc, if you can grab those folder names, should give you the other sites in the install. not really a good idea though, so im open to better suggestions :P.
if i get a chance will post the actual code for doing that in a bit
RTFM!
For further support or projects contact me.
Source Control - Web Design, Development and Hosting Oxfordshire, UK
Related
I am actually working to solve a multisite custom configuration to have the same Drupal core and DB instance for different sites and it is working.
I am not sure if it should be part of the core or just the as a custom module, but I think could be useful for the Drupal community.
http://drupal.org/node/1965620
For Drupal 8:
For Drupal 8:
Contact me to contract me for D7 -> D10/11 migrations.