Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
By yt2s on
Are there any Domain Access $variables that can be used in page.tpl.php, or template.php for theming purposes?
Comments
Yes, but not processed
There is data available, but not prepared for you.
Do this in template.php:
This will hand you an array of information about the current domain. So then you do something like:
This will hand you a $domain_name variable for use in the template.
You can also use hook_domainconf() to create variables per-domain that are accessible through variable_get(). And you can use domain_domains() to get information about all domains.
Thank you!
Exactly what I was looking for. Works like a charm. Thank you very much!
Modified...
For anyone who is interested...
I modified to suite the needs of my theme and added to the code above, (based on Step 1 of this post) to clean up the output to use as a CSS class in page.tpl:
$domain_class can now be used to print a class, based on the domain, in page.tpl.
Hope this helps someone.
Thanks again agentrickard This has really been helpful.