在scaffold Cakephp中显示除ID以外的其他内容 [英] Showing something other than ID in scaffold Cakephp
本文介绍了在scaffold Cakephp中显示除ID以外的其他内容的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我在我的模型中设置关联:
I setup associations in my models:
class User extends AppModel {
var $name = 'User';
var $hasMany = array('Post' => array('className' => 'Post'));
}
和
class Post extends AppModel {
var $name = 'Post';
var $belongsTo = array('User' => array('className' => 'User'));
}
哪些工作很好,除了脚手架,用户下拉列表显示ID number而不是用户名。 (用户名是一个列)如何让它显示用户名而不是id?
Which work great, except in the scaffold, the User dropdown list shows the ID number and not the username. (Username is a column) How do I get it to show the username instead of id?
推荐答案
:
var $displayField = 'username';
这篇关于在scaffold Cakephp中显示除ID以外的其他内容的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文