DEPRECATION WARNING
This documentation is not using the current rendering mechanism and is probably outdated. The extension maintainer should switch to the new system. Details on how to use the rendering mechanism can be found here.
Get gender from firstname¶
Author: | Kasper Skårhøj |
---|---|
Created: | 2002-11-01T00:32:00 |
Changed by: | Alex Kellner |
Changed: | 2008-11-26T11:36:44 |
Author: | Alex Kellner |
Email: | Alexander.Kellner@einpraegsam.net |
Info 3: | |
Info 4: |
Get gender from firstname¶
Extension Key: wt_genderfromfirstname
Copyright 2005-2008,
Alex Kellner,
<Alexander.Kellner@einpraegsam.net>
This document is published under the Open Content License
available from http://www.opencontent.org/opl.shtml
The content of this document is related to TYPO3
- a GNU/GPL CMS/Framework available from www.typo3.com
Table of Contents¶
Get gender from firstname 1
wt_genderfromfirstname introduction 2
What does it do? 2
Screenshots 3
How to use 4
Step by step: 4
Integration examples 5
Integration via typoscript 5
Integration via TYPO3 extension 5
Available database values for gender 6
FAQ 7
Why should I use the php class of the extension instead of programing my own db select 7
Why this database exists 7
Todos 8
Changelog 9
Additional links 10
wt_genderfromfirstname introduction¶
What does it do?¶
First of all wt_genderfromfirstname adds a new database table and fill it with about 45000 first names and fitting gender to the firstname.
In addition a added a small php class to get the gender from the database (if you don't want to program this part).
Screenshots¶
Database table wt_genderfromfirstname_table
How to use¶
Step by step:¶
- Import wt_genderfromfirstname from TER
- Import the database in the extension manage by clicking update
- Use the database in your extension or with typoscript (see examples below)
Integration examples¶
Integration via typoscript¶
Example code¶
includeLibs.user_gender = EXT:wt_genderfromfirstname/lib/class.tx_wtgenderfromfirstname.php
lib = USER_INT
lib.userFunc = tx_wtgenderfromfirstname->userFunc
lib.userFunc {
# Name is needed (Enter firstname)
name = TEXT
name.value = Alex
# Strict is optional (Return only m or f)
strict = 1
# Default is optional (Default value if no db entry)
default = x
# Rewritegender is optional (Change m and f into other values) works only if strict = 1!
rewritegender = Mr., Mrs.
}
Explanation¶
Name: define which firstname
Strict: If strict is set to 1 (default), the extension returns only “f” (for female) or “m” (for male), If strict is set to 0, the extension returns the exact database entry (could be “f”, “m”, “?f”, “?m”, “?”)
Default: If no entry was found (or if you use strict and the db entry was “?”), the extension will return the defined default value (empty for empty return)
Rewritegender: If you don't want to get “f” or “m”, you can rewrite the gender like “Mr., Mrs.” (commaseparated and in this case: Gentlemen first!)
Integration via TYPO3 extension¶
<?php
require_once(t3lib_extMgm::extPath('wt_genderfromfirstname').'lib/c lass.tx_wtgenderfromfirstname.php');
class tx_ext_pi1 {
function main() {
$firstname = 'Alex';
$strict = 1;
$default = '';
$rewritegender = 'Mr., Mrs.';
$gender = t3lib_div::makeInstance('tx_wtgenderfromfirstname');
return $gender->start($firstname, $strict, $default, $rewritegender);
}
}
?>
Explanation¶
First variable: define which firstname
Second variable: If strict is set to 1 (default), the extension returns only “f” (for female) or “m” (for male), If strict is set to 0, the extension returns the exact database entry (could be “f”, “m”, “?f”, “?m”, “?”)
Third variable: If no entry was found (or if you use strict and the db entry was “?”), the extension will return the defined default value (empty for empty return)
Fourth variable: If you don't want to get “f” or “m”, you can rewrite the gender like “Mr., Mrs.” (commaseparated and in this case: Gentlemen first!)
Available database values for gender¶
Values¶
a
Values
b
Description
F¶
a
F
b
Firstname belongs to a female person
M¶
a
M
b
Firstname belongs to a male person
?F¶
a
?F
b
Firstname belongs probable to a female person
?M¶
a
?M
b
Firstname belongs probable to a male person
?¶
a
?
b
Firstname could be female or male person (50/50)
FAQ¶
Why should I use the php class of the extension instead of programing my own db select¶
- Maybe I change the database entries in future, so if you make an update, it could be that your db select wont work any more
- But the output of the class will be the same in future
Why this database exists¶
We don't want to ask our homepage users if they are female or male to reduce the number of fields in every form
Todos¶
Maybe we've got a charset problem
Do you need a new feature? Maybe we can help you, so just write us!
Changelog¶
Additional links¶
You can use one of the following links, to get more informations about this plugin:
- Authors (Alex Kellner) homepage: http://www.einpraegsam.net
- Tuning parts for your car: http://www.wunschtacho.de
- Stuff for snowboarder and skier: http://www.justpowder.de
Do you need help with this plugin: http://www.typo3.net
Get gender from firstname - 10