assign() 공개 메소드

模板变量赋值
public assign ( mixed $name, mixed $value = '' )
$name mixed 变量名
$value mixed 变量值
 /**
  * 随便看看
  */
 public function look()
 {
     $prefix = C('DB_PREFIX');
     $sql = "select * from {$prefix}forum_post where status=1 order by rand() LIMIT 0 , " . modC('FORM_POST_SHOW_NUM_PAGE', '10', 'Forum');
     $post = M('')->query($sql);
     $post = $this->forumPostModel->assignForumInfo($post);
     if (IS_POST) {
         $view = new View();
         $view->assign('posts', $post);
         $view->display(T('Forum@Index/_look'));
         exit;
     }
     $this->assign('tab', 'look');
     $this->assign('posts', $post);
     $this->display();
 }
예제 #2
0
 /**
  * 随便看看
  */
 public function look()
 {
     $prefix = C('DB_PREFIX');
     $post = M('')->query("select * from {$prefix}forum_post order by rand()");
     $post = $this->forumPostModel->assignForumInfo($post);
     if (IS_POST) {
         $view = new View();
         $view->assign('posts', $post);
         $view->display(T('Forum@Index/_look'));
         exit;
     }
     $this->assign('tab', 'look');
     $this->assign('posts', $post);
     $this->display();
     //dump(D()->getLastSql());
     // dump($post);exit;
 }