我想在我的应用程序中使用ckeditor插件和分页;但是有一个问题。
如果我加载分页数据ckeditor不起作用。如果我加载ckeditor分页数据不起作用。
$data['pagination']=$this->pagination->create_links();
$data['ckeditor']=$this->data;
$this->load->view('index', $data); // pagination
在index.php
我可以写echo $pagination
,但不能使用$ckeditor
因为它的用法如下:
<?php echo display_ckeditor($ckeditor); ?>
答案 0 :(得分:3)
至少解决了问题。但你不能发送多个数据,因为ı做了。
你需要这样做:
$this->data['page_links']=$this->pagination->create_links();
$this->load->view('admin/index',$this->data);
ı在构造中制作了ckeditor所以它可以在任何地方使用它。
$this->data['ckeditor'] = array(
//ID of the textarea that will be replaced
'id' => 'content',
'path' => 'js/ckeditor',
//Optionnal values
'config' => array(
'toolbar' => "Full", //Using the Full toolbar
'width' => "750px", //Setting a custom width
'height' => '100px', //Setting a custom height
),
//Replacing styles from the "Styles tool"
'styles' => array(
//Creating a new style named "style 1"
'style 1' => array (
'name' => 'Blue Title',
'element' => 'h2',
'styles' => array(
'color' => 'Blue',
'font-weight' => 'bold'
)
),
//Creating a new style named "style 2"
'style 2' => array (
'name' => 'Red Title',
'element' => 'h2',
'styles' => array(
'color' => 'Red',
'font-weight' => 'bold',
'text-decoration' => 'underline'
)
)
)
);
答案 1 :(得分:0)
您应该将它们的数组发送到视图
$arrToView['ckeditor'] = $ckEditorData;
$arrToView['pagination'] = $paginationData;
$this->load->view('index', $arrToView);
我希望你正在尝试做什么
答案 2 :(得分:0)
控制器
$this->load->view('index', array(
'pagination' => $this->pagination->create_links(),
'ckeditor' => $this->data
));
查看
display_ckeditor(array($ckeditor));
编辑: 我还是很困惑。 确保你正确设置了分页,$ this-&gt; pagination-&gt; create_links()不是一个神奇的功能,你需要在Controller的基础上设置分页。阅读手册或查看我的示例。
public function index($offset=0){
$limit = $this->config->item('tbl_rows_returned');
//find pages based on limits and offset
$pages = Page::find('all',
array('limit' => $limit, 'offset' => $offset, 'order' => 'created_at desc')
);
//count total pages
$count = Page::count();
//init pagination attributes
$config = array(
'base_url' => site_url('admin/pages'),
'total_rows' => $count,
'per_page' => $limit,
'uri_segment' => 3
);
$this->pagination->initialize($config);
//load the view and pagination data
$this->load->view('templates/admin', array(
'content' => 'pages/admin/_index',
'pagination' => $this->pagination->create_links(),
'pages' => $pages
));
}