Access base URL of main site in another site in Drupal 7 - drupal-7

I have setup multisite in Drupal 7 and need to access theme settings and base url (test.com) of a main site in test1.test.com. How Can I do this one?
For example:
Main site: test.com<br>
Multisite: test1.test.com<br>
Multisite: test2.test.com <br>
likewise.
Folder structure:
sites/all/themes/testtheme/<br>
sites/test1/themes/custom_theme/test1<br>
sites/test2/themes/custom_theme/test2<br>
Thank you in advance.

I assume you should be using a different settings.php with a different DB for each sub-domain site, and in this case you can't access the variables of other sites into another site. However, there are two ways to get the main site base_url in other sites.
First, you could add a configurations variable through settings.php like $conf['main_site_base_url'] in individual settings.php OR the other way, if you are using a shared codebase, you can set this variable in custom module hook_init() or hook_boot() [whichever works with your setup] with this variable_get('main_site_base_url','test.com').
Once the confiuration variable set into the system you could get this using the variable_get function like variable_get('main_site_base_url','').
For inheriting the theme settings I would suggest to go with a sub-theme option as explained in this post.

Related

get 2sxc app data from different portal DNN

We are setting up different sites as portals in DNN. Some content will be shared across the different portals.
I'm using the following method to render 2sxc data in a page
http://2sxc.org/en/blog/post/using-2sxc-in-webforms-custom-webapi-or-other-razor-hosts-300
However, now i want get the same data in another page of a different portal.
Can any one help with the code so i just put in the source portal id and it can be rendered in a different portal?
Yes, this can be done :)
There's an App Data DataSource, where you can specifiy the portal and app-id (in 2sxc 8.5+). Use this in a visual query or in your code.
http://2sxc.org/en/Docs-Manuals/Feature/feature/9266

Deployment of new pages from Local to Production

I've a copy of DotNetNuke website on my local machine in which I've added few pages and created new modules.
I've to move these new pages to production so have copied the pages to respective folders. I know there are few database entries that are also to be made on production database to recognize these pages and modules on production.
Please tell me how I can register these pages on production website
I searched on Google but may be I'm not getting the right keywords to search. Currently I've to restore my local db to production to run those pages. I'm using version 7 of DNN
This isn't something that DNN handles very well, publishing from a local environment to production.
The most common way (Besides backup/restore of the database) is to use page Templates. You can "Export" a page in DNN, that will generate an XML document with the modules and content referenced into the portals/#/ folder (where # is the portal id)
You can upload that file to your production site (same path) and then create a new page based on that page template.
Your question implies that you are creating .aspx files and copying those to the production server. That really isn't the way that DNN works, and you probably are creating a real mess.
How did you create the pages on your local site? Did you use the DNN functionality to create new pages, add modules to those pages, etc.? Or, did you do something else?
Use the built-in funtionality to create pages on your local installation and, as Chris
To add modules - Go to your web site in production, login as super user, and install the module, then go to the page in the web site and add it. The same as you would do with 3rd party module. This will properly add the info to db.
To add pages - You could do it within the code, using the
To create DNN page (the tab):
TabController tbc = new TabController();
//...populating the page's info
tbc.AddTab(destinationTabInfo);
To create ascx control as global (meaning doesn't belong to any module) ModuleControl.
var moduleControl = new ModuleControlInfo
{
... populate the fields
};
ModuleControlController.AddModuleControl(moduleControl);

different theme in one website

Assume this is my site name : www.example.com.
I saw different websites have different themes in a site. For example I want to have different themes for www.example.com and www.example.com/othertheme. I know it should have different database for that. But how?
I should make a directory to the root of the server which named for example othertheme which has another database. then I can go to that website with this url : www.example.com/othertheme. So it has different theme in one website.

How do I name a drupal page template file according to a node's url path setting?

I'm new to drupal and having trouble naming a page template file. In drupal 7, let's say I've created a basic page with the url path as:
www.example.com/my-page
When I create a custom page template file, I've been able to get the file name page--node--[nid].tpl.php to work fine. However, I have 3 different sites (localhost, development, and production) and each has a different node id for this page (because the databases aren't sync'd). I need to find a way to name the template file according to the url path. I've tried all of the following, none of which has worked:
page--my-page.tpl.php
page--my_page.tpl.php
page--node--my-page.tpl.php
page--node--my_page.tpl.php
Any suggestions?
Check out the theme developer module. With it you should be able to get a list of possible template names that are being considered.

How to share DotNetNuke content across multiple pages?

I have just created a new DotNetNuke 6 website. The default installation has a social links area which is on each page. Can I change the contents of the social links (e.g set the Facebook href) in one central place or do I have to go to each page and edit the contents in each place?
DotNetNuke has a notion of referencing modules that would come in handy here. Essentially you can drop a new module on the page and configure it as you please, then go to another page and instead of dropping a new module, you select an existing module from another page. Now each of the modules appear to be separate, but are actually just the same module appearing in different places. You can then edit the module and the content will change across pages. *
To answer your question specifically - I don't believe this is how the default content is set up. You would need to go in and delete all of them (save one) and then reference the remaining elsewhere.
A couple of notes:
This behavior isn't absolute across all modules, technically each module gets to decide how it's content is shared across pages. Most modules, and notably the text/html module, work how I described, but some more advanced modules may not.
Additionally, the "copy module" option in the photo above will create a new module based on the original. If you don't have copy module selected, no new module will be created, the existing one will simply be referenced.

Resources