How to use minihaku (3)

Date 2006-09-01 13:00:24 | Category: XOOPS

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.




You can read more news at PEAK XOOPS.
http://xoops.peak.ne.jp

The URL for this story is:
http://xoops.peak.ne.jp/md/news/index.php?page=article&storyid=356