zoukankan      html  css  js  c++  java
  • [Drupal] Simple tutorial of setting multi subdomain with Domain Access module and Views module

    1. Set the hosts file.
    Open /etc/hosts file, add the code as below for example:

    # drupal
    127.0.0.1   drupal2.39.lan.gz
    127.0.0.1   *.drupal2.39.lan.gz

    2. Set the Virtual Hosts in Apache
    Open /opt/lampp/etc/httpd.conf, add the code as below for example:

    <VirtualHost *:80>
        <Directory "/media/MyDocuments/xampp/htdocs/drupal-2">
        </Directory>

        DocumentRoot "/media/MyDocuments/xampp/htdocs/drupal-2"
        ServerName drupal2.39.lan.gz
        ServerAlias *.drupal2.39.lan.gz
    </VirtualHost>

    3. Install the views module

    4. Install the Domain Access module.
    here I use the sites/default as a the primary site, so now edit
    the sites/default/settings.php, at the end of this file, add the code as below:

    /**
     * Add the domain module setup routine.
     */
    include './sites/all/modules/domain/settings.inc';

    Please see more details for why to add the code in the INSTALL.txt of Domain Access module.

    5. Set the subdomain in the website.
    Visit the page, http://drupal2.39.lan.gz/admin/build/domain , select the "Create domain
    record" tab to create a subdomain, here I create a subdomain as village-1.drupal2.39.lan.gz
    for example, so in the Domain field, I insert village-1.drupal2.39.lan.gz , and the Site name
    you can insert what you like. And then save it.
    Then as the steps above, I create another subdomain village-2.drupal2.39.lan.gz

    6. In the page http://drupal2.39.lan.gz/admin/build/domain
    "Domain node types" fieldset, uncheck all the checkbox for that I hope that all the content
    the editors created only display in the suddomain he belongs to. "Domain-specific settings"
    fieldset, select the "All domains" radiobox, and then save.

    7. Set the role of the Users.
    Visit the page, http://drupal2.39.lan.gz/admin/user/permissions/2 ,
    in the "domain module", check the checkbox as below:

    access inactive domains (option)
    administer domains
    edit domain nodes
    publish from assigned domain (option)
    publish from default domain (option)

    in the "node module", check the checkbox as below:

    access content
    create TYPE content (TYPE means that any content types in your website)
    edit own TYPE content (TYPE means that any content types in your website)
    revert revisions (option)
    view revisions (option)

    That is the option I suggest to set, of course, if you know what is the difference between them,
    you can set what you wish. :)

    8. Add some users.
    In the page, http://drupal2.39.lan.gz/admin/user/user/create ,
    Add the user, please be aware the "Domain access" fieldset, here you can set the subdomain
    which the user belongs to. Here is the example:
    editor1, village-1.drupal2.39.lan.gz
    editor2, village-2.drupal2.39.lan.gz

    9. Use views module to set the default page to the subdomain.
    In the page, http://drupal2.39.lan.gz/admin/build/views/add , here is an example,
    View name: village_page
    View type: Node
    Then click next
    Add display, in the "page settings" fieldset, set the path to "home", please pay attention to
    "Filters" fieldset, select the "Domains" in the "Groups", and then select checkbox
    the "Domains: Domain ID", in the next step, select the "Current Domain", save.
    About how to set the views parameters, please see the details in drupal.org/project/views.

    10. Set the default page of the subdomain.
    In the page, http://drupal2.39.lan.gz/admin/build/domain , click settings of village-1.drupal2.39.lan.gz ,
    in the "Site frontpage: " fieldset, insert the page path I set in above step -- that is home, save.
    Set that to village-2.drupal2.39.lan.gz in the same way.

    11. Login editor1 in village-1.drupal2.39.lan.gz
    Create some content after login.
    Login editor2 in village-2.drupal2.39.lan.gz
    Create some content after login.

    Then you will find that, that is differece when visiting village-1.drupal2.39.lan.gz and village-2.drupal2.39.lan.gz


    That is all of simple set the Domain Access module.

  • 相关阅读:
    从输入url到页面加载完成都发生了什么?
    JS 获取和监听屏幕方向变化(portrait / landscape)
    圣杯布局的几种情况
    闭包的使用 — 点击列表项输出项目索引
    论文笔记:dropout
    论文笔记:蒸馏网络(Distilling the Knowledge in Neural Network)
    ng-深度学习-课程笔记-17: 序列模型和注意力机制(Week3)
    ng-深度学习-课程笔记-16: 自然语言处理与词嵌入(Week2)
    ng-深度学习-课程笔记-15: 循环序列模型(Week1)
    Ubuntu安装dlib后import出现libstdc++.so.6: version `GLIBCXX_3.4.21' not found
  • 原文地址:https://www.cnblogs.com/davidhhuan/p/1793378.html
Copyright © 2011-2022 走看看