本文整理匯總了PHP中think\Controller::display方法的典型用法代碼示例。如果您正苦於以下問題:PHP Controller::display方法的具體用法?PHP Controller::display怎麽用?PHP Controller::display使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類think\Controller
的用法示例。
在下文中一共展示了Controller::display方法的13個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: display
public function display($tpl = '')
{
$P = $this->vhook_tpl . $tpl . '.php';
if (file_exists($P)) {
parent::display($P);
}
}
示例2: display
public function display()
{
$this->assign('meta_title', $this->meta_title);
$this->assign('post_url', $this->post_url);
$this->assign('form_data', $this->form_data);
$this->assign('form_items', $this->form_items);
$this->assign('is_ajax', $this->is_ajax);
parent::display($this->template);
}
示例3: display
protected function display($templateFile = '', $charset = '', $contentType = '', $content = '', $prefix = '')
{
if (trim($_REQUEST['ajax']) && $this->data) {
$dat = $this->data;
isset($this->navs) && ($dat['navs'] = $this->navs);
//$dat = array_merge((array)$dat,get_object_vars($this) ?: []);
$this->success($dat);
} else {
parent::display($templateFile, $charset, $contentType, $content, $prefix);
}
}
示例4: display
public function display($templateFile = '', $charset = '', $contentType = '', $content = '', $prefix = '')
{
$this->assign('DEBUG', C('DEBUG'));
$this->assign('BEAM', C('BEAM'));
$this->assign('assets_path', C('DEBUG') ? '/src' : '/statics');
$encodeShopId = $this->shop['shop_id'];
$shopId = \Common\Lib\Idhandler::decode($encodeShopId);
$this->assign('shop_id', $shopId);
$this->assign('shop_is_closed', $this->shop['is_closed']);
$this->assign('encode_shop_id', $encodeShopId);
$this->assign('default_image', C('DEFAULT_IMAGE'));
parent::display($templateFile, $charset, $contentType, $content, $prefix);
}
示例5: display
public function display($templateFile = '', $charset = '', $contentType = '', $content = '', $prefix = '')
{
parent::display($this->parseTemplate($templateFile), $charset, $contentType);
}
示例6: display
public function display()
{
//額外已經構造好的表單項目與單個組裝的的表單項目進行合並
$this->_form_items = array_merge($this->_form_items, $this->_extra_items);
//編譯表單值
if ($this->_form_data) {
foreach ($this->_form_items as &$item) {
if ($this->_form_data[$item['name']]) {
$item['value'] = $this->_form_data[$item['name']];
}
}
}
$this->assign('title', $this->_title);
$this->assign('tab_list', $this->_tab_list);
$this->assign('tab_url', $this->_tab_url);
$this->assign('current_tab', $this->_current_tab);
$this->assign('url', $this->_url);
$this->assign('form_items', $this->_form_items);
$this->assign('extra_html', $this->_extra_html);
parent::display($this->_template);
}
示例7: display
/**
* 顯示頁麵
* @author jry <598821125@qq.com>
*/
public function display()
{
//編譯data_list中的值
foreach ($this->_table_data_list as &$data) {
//編譯表格右側按鈕
foreach ($this->_right_button_list as $right_button) {
//禁用按鈕比較特殊,它需要根據數據當前狀態判斷是顯示禁用還是啟用
if ($right_button['type'] === 'forbid') {
$right_button = $right_button[$data['status']];
}
//將約定的標記[__data_id__]替換成真實的數據ID
$right_button['href'] = preg_replace('/\\[__data_id__\\]/i', $data[$this->_table_data_list_key], $right_button['href']);
//編譯按鈕屬性
$right_button['attribute'] = $this->compileHtmlAttr($right_button);
$data['right_button'] .= '<a ' . $right_button['attribute'] . '>' . $right_button['title'] . '</a> ';
}
//根據表格標題字段指定類型編譯列表數據
foreach ($this->_table_column_list as &$column) {
switch ($column['type']) {
case 'status':
switch ($data[$column['name']]) {
case '-1':
$data[$column['name']] = '<i class="fa fa-trash" style="color:red"></i>';
break;
case '0':
$data[$column['name']] = '<i class="fa fa-ban" style="color:red"></i>';
break;
case '1':
$data[$column['name']] = '<i class="fa fa-check" style="color:green"></i>';
break;
}
break;
case 'icon':
$data[$column['name']] = '<i class="' . $data[$field['name']] . '"></i>';
break;
case 'date':
$data[$column['name']] = time_format($data[$field['name']], 'Y-m-d');
break;
case 'time':
$data[$column['name']] = time_format($data[$field['name']]);
break;
case 'image':
$data[$column['name']] = '<img src="' . get_cover($data[$field['name']]) . '">';
break;
case 'type':
$form_item_type = C('FORM_ITEM_TYPE');
$data[$column['name']] = $form_item_type[$data[$column['name']]][0];
break;
}
}
}
//編譯top_button_list中的HTML屬性
foreach ($this->_top_button_list as &$button) {
$button['attribute'] = $this->compileHtmlAttr($button);
}
$this->assign('meta_title', $this->_meta_title);
//頁麵標題
$this->assign('top_button_list', $this->_top_button_list);
//頂部工具欄按鈕
$this->assign('search', $this->_search);
//搜索配置
$this->assign('tab_nav', $this->_tab_nav);
//頁麵Tab導航
$this->assign('table_column_list', $this->_table_column_list);
//表格的列
$this->assign('table_data_list', $this->_table_data_list);
//表格數據
$this->assign('table_data_list_key', $this->_table_data_list_key);
//表格數據主鍵字段名稱
$this->assign('table_data_page', $this->_table_data_page);
//表示個數據分頁
$this->assign('right_button_list', $this->_right_button_list);
//表格右側操作按鈕
$this->assign('extra_html', $this->_extra_html);
//額外HTML代碼
parent::display($this->_template);
}
示例8: display
protected function display($templateFile = '', $charset = '', $contentType = '', $content = '', $prefix = '')
{
parent::display($this->parseTmplateName($templateFile), $charset, $contentType, $content, $prefix);
}
示例9: display
/**
* 顯示頁麵
* @author jry <598821125@qq.com>
*/
public function display()
{
//編譯data_list中的值
foreach ($this->_table_data_list as &$data) {
//編譯表格右側按鈕
if ($this->_right_button_list) {
foreach ($this->_right_button_list as $right_button) {
//禁用按鈕與隱藏比較特殊,它需要根據數據當前狀態判斷是顯示禁用還是啟用
if ($right_button['type'] === 'forbid' || $right_button['type'] === 'hide') {
$right_button = $right_button[$data['status']];
}
//將約定的標記__data_id__替換成真實的數據ID
$right_button['href'] = preg_replace('/__data_id__/i', $data[$this->_table_data_list_key], $right_button['href']);
//編譯按鈕屬性
$right_button['attribute'] = $this->compileHtmlAttr($right_button);
$data['right_button'] .= '<a ' . $right_button['attribute'] . '>' . $right_button['title'] . '</a> ';
}
}
//根據表格標題字段指定類型編譯列表數據
foreach ($this->_table_column_list as &$column) {
switch ($column['type']) {
case 'status':
switch ($data[$column['name']]) {
case '-1':
$data[$column['name']] = '<i class="fa fa-trash text-danger"></i>';
break;
case '0':
$data[$column['name']] = '<i class="fa fa-ban text-danger"></i>';
break;
case '1':
$data[$column['name']] = '<i class="fa fa-check text-success"></i>';
break;
case '2':
$data[$column['name']] = '<i class="fa fa-eye-slash text-warning"></i>';
break;
}
break;
case 'icon':
$data[$column['name']] = '<i class="' . $data[$column['name']] . '"></i>';
break;
case 'date':
$data[$column['name']] = time_format($data[$column['name']], 'Y-m-d');
break;
case 'time':
$data[$column['name']] = time_format($data[$column['name']]);
break;
case 'picture':
$data[$column['name']] = '<img src="' . get_cover($data[$column['name']]) . '">';
break;
case 'type':
$form_item_type = C('FORM_ITEM_TYPE');
$data[$column['name']] = $form_item_type[$data[$column['name']]][0];
break;
}
}
/**
* 修改列表數據
* 有時候列表數據需要在最終輸出前做一次小的修改
* 比如管理員列表ID為1的超級管理員右側編輯按鈕不顯示刪除
*/
if ($this->_alter_data_list) {
foreach ($this->_alter_data_list as $alter) {
if ($data[$alter['condition']['key']] === $alter['condition']['value']) {
$data = array_merge($data, $alter['alter_data']);
}
}
}
}
//編譯top_button_list中的HTML屬性
if ($this->_top_button_list) {
foreach ($this->_top_button_list as &$button) {
$button['attribute'] = $this->compileHtmlAttr($button);
}
}
$this->assign('meta_title', $this->_meta_title);
//頁麵標題
$this->assign('top_button_list', $this->_top_button_list);
//頂部工具欄按鈕
$this->assign('search', $this->_search);
//搜索配置
$this->assign('tab_nav', $this->_tab_nav);
//頁麵Tab導航
$this->assign('table_column_list', $this->_table_column_list);
//表格的列
$this->assign('table_data_list', $this->_table_data_list);
//表格數據
$this->assign('table_data_list_key', $this->_table_data_list_key);
//表格數據主鍵字段名稱
$this->assign('table_data_page', $this->_table_data_page);
//表示個數據分頁
$this->assign('right_button_list', $this->_right_button_list);
//表格右側操作按鈕
$this->assign('alter_data_list', $this->_alter_data_list);
//表格數據列表重新修改的項目
$this->assign('extra_html', $this->_extra_html);
//額外HTML代碼
//.........這裏部分代碼省略.........
示例10: display
/**
* 重寫display方法,添加視圖輸出前標簽位
*/
protected function display($templateFile = '', $charset = '', $contentType = '', $content = '', $prefix = '')
{
Hook::listen('before_view', $this);
return parent::display($templateFile, $charset, $contentType, $content, $prefix);
}
示例11: display
public function display()
{
//編譯button_list中的HTML屬性
foreach ($this->_button_list as &$button) {
$button['attr'] = $this->compileHtmlAttr($button['attr']);
}
//編譯data_list中的值
foreach ($this->_data_list as &$data) {
//編譯表格右側按鈕
foreach ($this->_right_button_list as $right_button) {
switch ($right_button['type']) {
case 'edit':
$right_button['link'] = '<a href="' . U($right_button['url'], array('id' => $data[$this->_data_list_primary_key])) . '">編輯</a> ';
break;
case 'forbid':
switch ($data['status']) {
case '1':
$right_button['link'] = ' <a href="' . U(MODULE_NAME . '/' . CONTROLLER_NAME . '/setStatus', array('status' => 'forbid', 'model' => $right_button['model'], 'ids' => $data[$this->_data_list_primary_key])) . '" class="ajax-get confirm">禁用</a> ';
break;
case '0':
$right_button['link'] = ' <a href="' . U(MODULE_NAME . '/' . CONTROLLER_NAME . '/setStatus', array('status' => 'resume', 'model' => $right_button['model'], 'ids' => $data[$this->_data_list_primary_key])) . '" class="ajax-get confirm">啟用</a> ';
break;
case '-1':
$right_button['link'] = ' <a href="' . U(MODULE_NAME . '/' . CONTROLLER_NAME . '/setStatus', array('status' => 'restore', 'model' => $right_button['model'], 'ids' => $data[$this->_data_list_primary_key])) . '" class="ajax-get confirm">還原</a> ';
break;
}
break;
case 'delete':
$right_button['link'] = '<a href="' . U(MODULE_NAME . '/' . CONTROLLER_NAME . '/setStatus', array('status' => 'delete', 'model' => $right_button['model'], 'ids' => $data[$this->_data_list_primary_key])) . '" class="ajax-get confirm">刪除</a> ';
break;
case 'recycle':
$right_button['link'] = '<a href="' . U(MODULE_NAME . '/' . CONTROLLER_NAME . '/setStatus', array('status' => 'recycle', 'ids' => $data[$this->_data_list_primary_key])) . '" class="ajax-get confirm">回收</a> ';
break;
case 'self':
if (!$right_button['attr']['addon']) {
$right_button['attr']['href'] = U($right_button['attr']['href'] . $data[$this->_data_list_primary_key]);
} else {
$right_button['attr']['href'] = addons_url($right_button['attr']['href'] . '/id/' . $data[$this->_data_list_primary_key]);
}
$attr = $this->compileHtmlAttr($right_button['attr']);
$right_button['link'] = '<a ' . $attr . '>' . $right_button['attr']['title'] . '</a> ';
break;
}
$data['right_button'] .= $right_button['link'];
}
//根據表格標題字段指定類型編譯列表數據
foreach ($this->_field_list as &$field) {
switch ($field['type']) {
case 'status':
switch ($data[$field['name']]) {
case '-1':
$data[$field['name']] = '<i class="glyphicon glyphicon-trash" style="color:red"></i>';
break;
case '0':
$data[$field['name']] = '<i class="glyphicon glyphicon-ban-circle" style="color:red"></i>';
break;
case '1':
$data[$field['name']] = '<i class="glyphicon glyphicon-ok" style="color:green"></i>';
break;
}
break;
case 'icon':
$data[$field['name']] = '<i class="' . $data[$field['name']] . '"></i>';
break;
case 'date':
$data[$field['name']] = time_format($data[$field['name']], 'Y-m-d');
break;
case 'time':
$data[$field['name']] = time_format($data[$field['name']]);
break;
case 'image':
$data[$field['name']] = '<img src="' . get_cover($data[$field['name']]) . '">';
break;
case 'type':
$form_item_type = C('FORM_ITEM_TYPE');
$data[$field['name']] = $form_item_type[$data[$field['name']]];
break;
}
}
}
$this->assign('title', $this->_title);
$this->assign('button_list', $this->_button_list);
$this->assign('search', $this->_search);
$this->assign('tab_list', $this->_tab_list);
$this->assign('tab_url', $this->_tab_url);
$this->assign('current_tab', $this->_current_tab);
$this->assign('field_list', $this->_field_list);
$this->assign('data_list', $this->_data_list);
$this->assign('data_list_primary_key', $this->_data_list_primary_key);
$this->assign('right_button_list', $this->_right_button_list);
$this->assign('page', $this->_page);
$this->assign('extra_html', $this->_extra_html);
parent::display($this->_template);
}
示例12: display
public function display()
{
$this->assign('meta_title', $this->meta_title);
$this->assign('post_url', $this->post_url);
$this->assign('is_ajax', $this->is_ajax);
$this->assign('set_coulmn', $this->set_coulmn);
$this->assign('page_list', $this->page_list);
$this->assign('page_items', $this->page_items);
// var_dump($this);打印查看測試
parent::display($this->template);
}
示例13: display
/**
* 顯示頁麵
* @author jry <598821125@qq.com>
*/
public function display()
{
//額外已經構造好的表單項目與單個組裝的的表單項目進行合並
$this->_form_items = array_merge($this->_form_items, $this->_extra_items);
//編譯表單值
if ($this->_form_data) {
foreach ($this->_form_items as &$item) {
if ($this->_form_data[$item['name']]) {
$item['value'] = $this->_form_data[$item['name']];
}
}
}
$this->assign('meta_title', $this->_meta_title);
//頁麵標題
$this->assign('tab_nav', $this->_tab_nav);
//頁麵Tab導航
$this->assign('post_url', $this->_post_url);
//標題提交地址
$this->assign('form_items', $this->_form_items);
//表單項目
$this->assign('ajax_submit', $this->_ajax_submit);
//額外HTML代碼
$this->assign('extra_html', $this->_extra_html);
//是否ajax提交
parent::display($this->_template);
}