主题用户注册页面在Drupal 6与欧米茄子主题 [英] Theme user registration page in Drupal 6 with an Omega subtheme

查看:161
本文介绍了主题用户注册页面在Drupal 6与欧米茄子主题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在D6上发现了很多关于如何做到这一点的教程,但是看来,我发现的示例代码在Omega子主题上并不起作用。



这里是我发现它最适合我的代码(通过Trellon ):



Inside template.tpl.php:

 <?php 
函数themename_theme($ existing,$ type,$ theme,$ path){
return array(
...
//告诉Drupal用于用户注册表单的模板
'user_register'=>数组(
'arguments'=>数组('form'=> NULL),
'模板'=>'user-register',//这是模板的名称
),
...
);
}
?>

这里是user-register.tpl.php表单:

 < div id =registration_form> 
< div class =field>
<?php
print drupal_render($ form ['account'] ['name']); //打印用户名字段
?>
< / div>
< div class =field>
<?php
print drupal_render($ form ['account'] ['pass']); //打印密码字段
?>
< / div>
< div class =field>
<?php
print drupal_render($ form ['submit']); //打印提交按钮
?>
< / div>
< / div>
< / div>事情是在我的template.tpl.php文件里面我已经声明了mytheme_theme,所以我不知道如何添加新的代码。



Inside我的omega子集文件夹:

  / ** 
* HOOK_theme()的实现。
* /
函数lcph_theme(& $ existing,$ type,$ theme,$ path){
$ hooks = omega_theme($ existing,$ type,$ theme,$ path);
//添加您的主题钩子,如下所示:
/ *
$ hooks ['hook_name_here'] = array(// Details go here);
* /
// @TODO:需要详细的评论。补丁欢迎!
return $ hooks;

}

其实如果我只是复制/粘贴代码里面我的模板文件,这是我得到的错误:

 致命错误:无法重新声明lcph_theme()(以前声明在/ site / all / themes / lcph / template.php:22)在第125行的/sites/all/themes/lcph/template.php 

如何将示例代码添加到我的omega子主题模板中?
感谢您的指导和帮助!



Rosamunda

解决方案

p>不要添加任何东西到template.php文件,除非你在你的模板.php文件中搜索omega_theme()函数,如果你发现它然后修改它...如果你没有找到它然后创建自己的一个... ...我不明白你,但也许以下步骤可能会帮助你



1-搜索你的template.php文件
*如果你没有找到它然后在您的主题文件夹中创建一个自己的一个
2-在你的template.php文件中搜索urthemename_theme()函数
*如果你发现它,那么你可以修改它...如果你不'你可以创建自己的函数
作为以下

 函数omega_theme($ existing,$ type,$ theme, $路径){
返回数组(
'user_register'=>数组(
'arguments'=>数组('form'=> NULL),
' '=>'user-register',//这是名字o f模板
),
);
}

3-在ur主题文件中搜索user_register.tpl.php文件.. 。如果你没有找到它,然后创建
你自己的,并在其中放入以下代码

 < div id =registration_form> 
< div class =field>
<?php
print drupal_render($ form ['account'] ['name']); //打印用户名字段
?>
< / div>
< div class =field>
<?php
print drupal_render($ form ['account'] ['pass']); //打印密码字段
?>
< / div>
< div class =field>
<?php
print drupal_render($ form ['submit']); //打印提交按钮
?>
< / div>
< / div>
< / div>

我不知道你的意思是什么template.tpl.php文件...我想你的意思是模板.php
i希望能帮助你


I´ve found numerous tutorials on how to do this on D6, BUT, it seems that the example code I´ve found doesn´t quite work on Omega subtheme.

Here´s the code I´ve found it suits me best (via Trellon):

Inside template.tpl.php:

<?php
function themename_theme($existing, $type, $theme, $path) {
  return array(
    ...
    // tell Drupal what template to use for the user register form
    'user_register' => array(
      'arguments' => array('form' => NULL),
      'template' => 'user-register', // this is the name of the template
    ),
    ...
  );
}
?>

And here´s the user-register.tpl.php form:

<div id="registration_form">
  <div class="field">
    <?php
      print drupal_render($form['account']['name']); // prints the username field
    ?>
  </div>
  <div class="field">
    <?php
      print drupal_render($form['account']['pass']); // print the password field
    ?>
  </div>
  <div class="field">
    <?php
        print drupal_render($form['submit']); // print the submit button
      ?>
    </div>
  </div>
</div>

The thing is that inside my template.tpl.php file I´ve already declared mytheme_theme, so I don´t know how to add the new code.

Inside My omega subtheme folder:

/**
 * Implementation of HOOK_theme().
 */
function lcph_theme(&$existing, $type, $theme, $path) {
  $hooks = omega_theme($existing, $type, $theme, $path);
  // Add your theme hooks like this:
  /*
  $hooks['hook_name_here'] = array( // Details go here );
  */
  // @TODO: Needs detailed comments. Patches welcome!
  return $hooks;

}

In fact, if I just copy/paste the code inside my template file, this is the error I´ve got:

Fatal error: Cannot redeclare lcph_theme() (previously declared in /sites/all/themes/lcph/template.php:22) in /sites/all/themes/lcph/template.php on line 125

How could I add the example code inside my omega subtheme template? Thanks for your guidance and help!

Rosamunda

解决方案

dont add any thing to template.php file unless you search in your template.php file for omega_theme() function if you found it then modify it...if you didn't find it then create ur own one...... i dont understand u exactly but maybe the following steps may help you

1- search for your template.php file * if you didn't find it then create ur own one in your theme folder 2- search for urthemename_theme() function in your template.php file * if you found it then you can modify it... if you don't you can create ur own function as the following

function omega_theme($existing, $type, $theme, $path) {
  return array(
    'user_register' => array(
      'arguments' => array('form' => NULL),
      'template' => 'user-register', // this is the name of the template
    ),
  );
}

3- search for user_register.tpl.php file in ur theme files...if u didn't find it then create your own one and put the following code inside it

<div id="registration_form">
  <div class="field">
    <?php
      print drupal_render($form['account']['name']); // prints the username field
    ?>
  </div>
  <div class="field">
    <?php
      print drupal_render($form['account']['pass']); // print the password field
    ?>
  </div>
  <div class="field">
    <?php
        print drupal_render($form['submit']); // print the submit button
      ?>
    </div>
  </div>
</div>

i dont know what you mean by template.tpl.php file...i think you mean template.php i hope that help you

这篇关于主题用户注册页面在Drupal 6与欧米茄子主题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆