Drupal 联系表单不显示主题
所以我已经定制了 Drupal 6 的用户登录/通行证/注册页面,没有任何问题。然而,我现在对联系邮件页面(启用联系模块)做同样的事情,我得到的只是联系表格,没有主题。我做错了什么?
function mytheme_theme() {
return array(
'user_login' => array(
'template' => 'user-login',
'arguments' => array('form' => NULL),
),
'user_register' => array(
'template' => 'user-register',
'arguments' => array('form' => NULL),
),
'user_pass' => array(
'template' => 'user-pass',
'arguments' => array('form' => NULL),
),
'contact_mail_page' => array(
'template' => 'page-contact',
'arguments' => array('form' => NULL),
),
);
}
So I've gone and customized the user login/pass/register pages Drupal 6 and no problems. However I now do the same thing with the contact mail page (contact module enabled) and all I get is the contact form and NO theme. What am I doing wrong?
function mytheme_theme() {
return array(
'user_login' => array(
'template' => 'user-login',
'arguments' => array('form' => NULL),
),
'user_register' => array(
'template' => 'user-register',
'arguments' => array('form' => NULL),
),
'user_pass' => array(
'template' => 'user-pass',
'arguments' => array('form' => NULL),
),
'contact_mail_page' => array(
'template' => 'page-contact',
'arguments' => array('form' => NULL),
),
);
}
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
要主题化整个页面,您根本不需要将该项目添加到代码中(事实上,这可能是您没有获得任何主题的原因 - 您的项目与默认行为冲突)。
假设您的联系页面的网址为“http://www.your-site.com/contact”,只需在主题目录中创建 page-contact.tpl.php (..并清除主题注册表,每次都会得到我)。
这适用于所有页面 - 创建一个基于 page.tpl.php 的模板,并以 url 参数命名。例如, page-taxonomy-term.tpl.php 将用于主题 http://www .your-site.com/taxonomy/term。
To theme a full page you shouldn't need to add that item into your code at all (in fact, it may be the reason you're not getting any theme - your item is conflicting with the default behaviour).
Presuming the url for your contact page is "http://www.your-site.com/contact", just create page-contact.tpl.php in your theme directory (..and clear the theme registry, gets me every time).
This goes for all pages - create a template based on page.tpl.php, and named after the url arguments. For example, page-taxonomy-term.tpl.php will be used to theme http://www.your-site.com/taxonomy/term.
看起来您正在创建一个模块而不是主题。使用 drupal6,您可以扩展现有主题,而无需尝试覆盖每个项目的主题。
查看主题 .info 文件中的基本主题,以及 < a href="http://drupal.org/node/171179" rel="nofollow noreferrer">创建您自己的主题
It looks like you are creating a module rather than a theme. With drupal6 you can extend an exsisting theme, negating the need for you to try and override the theme for each item.
Have a look at base theme in the theme .info file, and the documentation on creating your own theme