我开始使用CMS (和codeIgniter)。我选择FuelCMS是因为语言.
到目前为止,一切都很顺利。我有一个控制器来处理页面,语言,..
我在视图下建立了页面的层次结构:
de/页1 de/页2 联合王国/第1页 联合王国/第2页
但是现在我想编辑那个页面的具体内容。我有两个街区,我一直使用:一个页眉和一个页脚。Page1看起来是这样的:
<?php $this->load->view('_blocks/de/header')?>
// HERE I WANT TO GET THE EDITABLE CONTENT OF THE PAGE...
<?php $this->load->view('_blocks/de/footer')?>但我不清楚如何在fuelCMS中获得页面。如果我让它们直接在CMS中测试一段时间以前,它是有效的,但我不能使用我的自定义控制器。
如何在CMS中显示页面,只允许它们编辑内容--我的页面的一部分?
发布于 2015-10-07 01:44:02
我不会百分之百地关注你的问题,但我会尽力帮助你。假设您使用的是1.0版本,并且希望在管理界面中的“页面”下有可编辑的布局。
您要做的第一件事是打开/fuel/config/MY_fuel.php并添加以下内容:
// languages for pages. The key is saved to the page variables
$config['languages'] = array(
'en' => 'English',
'de' => 'Dutch'
);
$config['language_mode'] = 'segment';然后,打开/fuel/config/MY_fuel_layouts.php并创建一个布局。下面是一个基本的问题:
# Common meta
$common_meta = [
'meta' => [
'type' => 'fieldset',
'label' => 'Meta',
'class' => 'tab'
],
'meta_section' => [
'type' => 'copy',
'label' => 'The following fields control the meta information found in the head of the HTML.'
],
'body_class' => [],
'page_title' => [
'label' => lang('layout_field_page_title'),
'description' => 'This displays at the very top of the browser bar.'
],
'meta_description' => [
'style' => 'width: 520px',
'label' => lang('layout_field_meta_description')
],
'meta_keywords' => array(
'style' => 'width: 520px',
'label' => lang('layout_field_meta_keywords')
]
];
# Common content
$common_content = [
'common_content' => [
'type' => 'fieldset',
'label' => 'Content',
'class' => 'tab'
],
'page_heading' => array(
'label' => 'Page heading',
'description' => 'This displays at the top of the page in the content'
],
'body' => array(
'label' => lang('layout_field_body'),
'type' => 'textarea',
'description' => lang('layout_field_body_description')
]
];
$main_layout = new Fuel_layout('main');
$main_layout->set_description('This is the layout for most pages.');
$main_layout->set_label('Main');
$main_layout->add_fields($common_content);
$main_layout->add_fields($common_meta);确保在/燃料/应用程序/视图/_layout中有一个名为main.php的文件
当您进入页面/在燃料中创建时,您将在页面顶部的布局下面看到一个“语言”选择。这就是如何为相同的布局设置不同的语言内容。
这两页是这样制作的:http://impression.co.nz/sell http://impression.co.nz/ch/sell
如果您仍然需要一个控制器来截取,您可以使用以下方法从控制器呈现一个cms页面:
$this->fuel->pages->render('url', [], ['render_mode' => 'cms']);
其中url是管理员中的"location“值,而空数组是一些您可能希望传递的vars。
这有用吗?还是离得很远?
https://stackoverflow.com/questions/32867297
复制相似问题