Hi,
I'm looking for a way to have dataface fill columns holding username, timestamp, etc. automatically. I haven't yet read all of the documentation - could anybody point me to the right place to look for?
Christian
columns with automatic content
2 posts
• Page 1 of 1
You can use the beforeInsert() trigger:
http://framework.weblite.ca/documentation/tutorial/getting_started/triggers Note.. I recommend you read at least the first 5 or 6 sections of the getting started tutorial if you want to start building with dataface. It doesn't take too long and it should give you some good background on what you need to do. e.g.: function beforeInsert(&$record){ $record->setValue('username', 'some username'); } or even better function beforeInsert(&$record){ $auth =& Dataface_AuthenticationTool::getInstance(); $user =& $auth->getLoggedInUser(); if ( $user ){ $record->setValue('username', $user->val('username')); } } For the timestamp, you can either use a MySQL timestamp field to have mysql do it for you automatically, or you can use a datetime field and use the 'timestamp' directive in the fields.ini file. e.g. [mydatefield] timestamp=insert or [mydatefield] timestamp=update -Steve
2 posts
• Page 1 of 1
Who is onlineUsers browsing this forum: No registered users and 31 guests |