Drupal 6 按域自定义首页

发布于 2024-10-18 15:03:36 字数 848 浏览 0 评论 0原文

我有一个房地产代理的 drupal 6 网站。由于每个代理都有自己的网址,因此我想将它们全部定向到主网站,并为每个域名使用不同的主页(在本例中是他们的用户个人资料页面,可以查看其属性)。

到目前为止,我使用模块的 init() 函数来检查域是否与主域不同,并查找该域属于哪个用户。

我知道我可以使用 drupal_goto('users/username') 但我更愿意在不更改 url 的情况下执行此操作。这样,该网站看起来更适合代理“定制”,而不是主网站中的重定向。

这是我的 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
        }
    }
}

非常感谢您的想法。

I have a drupal 6 website for a real estate agency. 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).

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.

I know I could use drupal_goto('users/username') but I would prefert to do it without changing the 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:

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.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

爺獨霸怡葒院 2024-10-25 15:03:36

您是否尝试过首页模块

http://drupal.org/project/front

或者您也可以使用启动页面

http://drupal.org/project/splash

Have you tried the front page module

http://drupal.org/project/front

Or you can also use a splash page

http://drupal.org/project/splash

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文