简体   繁体   English

按域的Drupal 6自定义首页

[英]Drupal 6 custom frontpage by domain

I have a drupal 6 website for a real estate agency. 我有一家房地产中介公司的drupal 6网站。 Since each agents have their own url, I want to direct them all to the main website and use a different homepage per domain name (in this case their user profile page which have a view of their properties). 由于每个代理都有自己的URL,因此我想将它们全部定向到主网站,并为每个域名使用不同的首页(在这种情况下,其用户配置文件页面会显示其属性)。

So far I use the init() function of a module to check if the domain is different from the main one and find to which user the domain belong. 到目前为止,我使用模块的init()函数来检查域是否与主域不同,并查找该域所属的用户。

I know I could use drupal_goto('users/username') but I would prefert to do it without changing the url. 我知道我可以使用drupal_goto('users / username'),但是我更愿意在不更改URL的情况下进行操作。 This way the site look more "customize" to the agent rather than a redirect in the main website. 这样,站点看起来更“定制”给代理,而不是主站点中的重定向。

Here is the code of my init() function: 这是我的init()函数的代码:

if(!strstr($_SERVER['SERVER_NAME'],'maindomain')){
    //look in profile field id 8 to which user the domain belong
    $value = db_result(db_query("SELECT uid FROM {profile_values} WHERE fid = 8 AND value like '%s'"), $_SERVER['SERVER_NAME']);
    if($value){
        //store the uid in $agent_site for further use
        global $agent_site;
        $agent_site = $value;
        if(drupal_is_front_page()){
            //Do the equivalent of drupal_goto('users/username') without modifying the url
        }
    }
}

Thank you very much for your ideas. 非常感谢您的想法。

Have you tried the front page module 您是否尝试过首页模块

http://drupal.org/project/front http://drupal.org/project/front

Or you can also use a splash page 或者您也可以使用启动页面

http://drupal.org/project/splash http://drupal.org/project/splash

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM