感谢大家的热情帮助,我上面的问题已经解决了!!smarty中code这样写: 这里是class public static function get_emp_all(){
return DB::getAll("select b.id,b.cid,b.staff_company,b.guakao,a.dept_code,d.title_code,b.idencard,b.phone,b.staff_realname,b.staff_nicheng,c.role_code from erp_deptment a,erp_employee b,erp_role c,erp_title d where b.deptID = a.ID and b.title_id = c.ID and b.role_id = d.id"); } 这里是control: public function default_action(){ $list = HR::get_emp_all();
public function default_action(){
$hr = new HR;
$empid = "S0001";
$info = $hr->get_emp_list($empid);
$args=array('arg1' => $empid,'arg2' => 'aaaaaaaaa');
//$args['empinfo'] = $info;
$this->show_page('index',$args);
}
public function show_page($tpl,$data=null,$return=false){
if(!is_null($data) && is_array($data)){
foreach($data as $key=>$item){
$this->page->add($key,$item);
}
}
$this->page->name=$tpl;
if($return){
return $this->page->fetch();
}else{
$this->page->show();
}
}
我不知道这个:$info = $hr->get_emp_list($empid);
有木有值,用echo 和 print 都显示不到这种语法 我根本就不会啊!!!
能不能说详细一点啊!!$args=array('arg1' => $empid,'arg2' => 'aaaaaaaaa');这样:print_r $args;貌似不行
print <<<EOT
<div class="sContent">
<dl>
<dt>员工流水号</dt>
<dd><ul><li><a href=""><{$arg1}></a></li></ul></dd>
</dl>
<dl>
<dt>昵称</dt>
<dd><{$arg2}></dd>
</dl>
</div>
EOT;
?>
$args=array('arg1' => $empid,'arg2' => 'aaaaaaaaa');
include ('**.tpl');
这里是class
public static function get_emp_all(){
return DB::getAll("select b.id,b.cid,b.staff_company,b.guakao,a.dept_code,d.title_code,b.idencard,b.phone,b.staff_realname,b.staff_nicheng,c.role_code from erp_deptment a,erp_employee b,erp_role c,erp_title d
where
b.deptID = a.ID
and b.title_id = c.ID
and b.role_id = d.id");
}
这里是control:
public function default_action(){
$list = HR::get_emp_all();
$args=array('list' => $list);
$this->show_page('index',$args);
}
页面上:
<table>
<{foreach from=$list item=item}>
<tr><td><{$item.id}></td></tr>
<tr><td><{$item.staff_realname}></td></tr></{forwach}>
</table>
每次遇到问题,其实就在csdn上寻找心灵的寄托,我知道可能我自己的问题只有我自己最清楚但是就想在这写写,灰常感谢亲们的热情解答!!!在上进ing...