我正在尝试使用 P4A 应用程序框架制作小部件,并且我有一个直到最后一个掩码的反射声音代码,这应该使生成的小部件使用户能够移动到另一个应执行不同功能的掩码,错误源自代码所在的第 28 行;
->load($this->locations);
我相信它扩展了类,但我不确定,有什么帮助......其余的代码如下
class main_dashboard_mask extends P4A_Base_Mask
{
public $locations = array(
array('value'=>'area1','description'=>'area one'),
array('value'=>'area2','description'=>'area two'),
array('value'=>'area3','description'=>'area three'),
);
public function __construct()
{
parent::__construct();
$p4a = p4a::singleton();
$this->setTitle("Dashboard");
$this->build('p4a_field','MeetingRooms');
$this->MeetingRooms->setLabel("This is the meeting room label");
$this->build('p4a_button', 'continue')
->setLabel('Continue?')
->implement("onclick", $this, "change");
$this->build('p4a_field','booking')
->setlabel('Viewing?')
->setType('checkbox')
->setValue(true);
$this->booking->label->setTooltip('If you are booking a meeting room, check this box');
$this->build("P4A_Array_Source", "location")
->getPk("value")
->load($this->locations);
$this->build('p4a_field','location')
->setLabel('location')
->setValue('area1')
->setType('select')
->setSource($this->location)
->setWidth(60);
$this->weight->label->setWidth(60);
$this->MeetingRooms();
}
private function MeetingRooms()
{
$this->build('P4A_fieldset', 'widgetframe')
->anchor($this->location)
->anchorLeft($this->booking)
->anchorLeft($this->continue)
->setLabel('Meeting Room Bookings');
}
}
如有任何帮助,我们将不胜感激=]。
最佳答案
好吧,试试这个,它可能对你更好。
这是代码:
public function __construct()
{
parent::__construct();
$this->setTitle("Dashboard");
$this->build('p4a_field','MeetingRooms');
$this->MeetingRooms->setLabel("This is the meeting room label");
$this->build('p4a_button', 'continue')
->setLabel('Continue?')
->implement("onclick", $this, "change");
$this->build('p4a_field','booking')
->setlabel('Booking?')
->setType('checkbox')
->setValue(false);
$this->booking->label->setTooltip('If you are booking a meeting room, check this box');
$this->build("p4a_db_source", "login")
->setTable("meetingrooms")
->load()
->firstRow();
$this->build('p4a_field','location')
->setSource($this->login)
->setLabel('location')
->setType('select')
->setSourceValueField("position")
->setSourceDescriptionField("MeetingRoom")
->setWidth(120);
$this->build("p4a_fieldset","Book")
->anchor($this->location)
->anchor($this->booking)
->anchor($this->continue)
->setLabel('Meeting room bookings');
$this->display("main",$this->Book);
}
}
祝你好运:) 感谢您接受我的才华xx
关于php - fatal error : Call to a member function load() on a non-object (P4A application Framework),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13013290/