PEAK XOOPS - How to use minihaku (3) in englishin japanese

Archive | RSS |
XOOPS
XOOPS : How to use minihaku (3)
Poster : GIJOE on 2006-09-01 13:00:24 (15093 reads)

in englishin japanese
How to add fields.
This is an example to add two columns "sex" and "birth".

I. ALTER TABLE (add columns into users table of DB)

ALTER TABLE (prefix)_users ADD sex tinyint not null default 0 ;
ALTER TABLE (prefix)_users ADD birth date not null default '1950-01-01' ;

II. Edit three templates

Use altsys or tplsadmin.

II-1 edit minihaku_register.html
Insert this.


	<tr valign="top" align="left">
		<td class="head">sex</td>
		<td class="even">
			<{html_radios name="sex" options=$sex_options selected=$sex}>
		</td>
	</tr>
	<tr valign="top" align="left">
		<td class="head">birthday</td>
		<td class="even">
			<{html_select_date field_order="YMD" month_format="%m" day_format="%02d" start_year="-100" end_year="-1" time=$birth }>
		</td>
	</tr>


II-2 edit minihaku_edituser.html
Insert this.

	<tr valign="top" align="left">
		<td class="head">sex</td>
		<td class="even">
			<{html_radios name="sex" options=$sex_options selected=$sex}>
		</td>
	</tr>
	<tr valign="top" align="left">
		<td class="head">birthday</td>
		<td class="even">
			<{html_select_date field_order="YMD" month_format="%m" day_format="%02d" start_year="-100" end_year="-1" time=$birth }>
		</td>
	</tr>


II-3 edit system_userinfo.html
Insert this.

        <tr valign="top">
          <td class="head">sex</td>
          <td class="odd"><{$user_uid|minihaku_userinfo:"sex":"uid"}></td>
        </tr>
        <tr valign="top">
          <td class="head">birthday</td>
          <td class="odd"><{$user_uid|minihaku_userinfo:"birth":"uid"}></td>
        </tr>

If you got errors, you should check minihaku's smarty plugin exits -
class/smarty/plugins/modifier.minihaku_userinfo.php

III. prepare include/config.php and write the logic

In this sample, rename include/config.dist.php into include/config.php.
That's all.
I'll explain the login in the next stage.


Related articles
Printer friendly page Send this story to a friend

Comments list

tsujiemon  Posted on 2006/12/9 20:17
自己レスです。

うまくいかなかった原因がわかりました。
minihaku_register.phpの記述がまずかったようです。
以下、修正したものです。
---------
<td class="even"><select name="user_from"><{html_options options=$user_from_options selected=$user_from}></select></td>
---------

また、「$sex_options」という変数をセットしている場所もわかりました。
registerhook.phpの最後の方でやっているんですね。


お騒わせしまして申し訳ありませんでした。
tsujiemon  Posted on 2006/12/9 18:35
PHP初心者です。(Javaエンジニアです) 基本的なことなのかもしれませんが、わからないので、教えていただきたいのですが。

「II-1 登録フォームに追加」のところで「$sex_options」という変数を使われていますが、この変数にはどこで値がセットされるのでしょうか?

都道府県のセレクトボックスを追加しようとしているのですが、うまくいきません。
下記のような感じで行っています。
minihaku_register.php
---------
<td class="even"><select name="user_from">{html_options options=$user_from_options selected=$user_from}</select></td>
---------

config.php
---------
$extra_fields = array(
'user_from' => array(
'initval' => -1,
'options' => array(
1 => '北海道',
2 => '青森県',

---------

よろしくお願い致します。
Login
Username or e-mail:

Password:

Remember Me

Lost Password?

Register now!