我没有 100% 关注您的问题,但我会尽力提供帮助。假设您使用的是 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);
确保在 /fuel/application/views/_layouts 中有一个名为 main.php 的文件
当您前往页面/在 FUEL 中创建时,您会在页面顶部的布局之一下看到“语言”选择。这就是您为同一布局设置不同语言内容的方式。
这就是这两个页面的制作方式:http:
//impression.co.nz/sell
http://impression.co.nz/ch/sell
如果你仍然需要一个控制器来拦截,你可以从一个控制器渲染一个 cms 页面:
$this->fuel->pages->render('url', [], ['render_mode' => 'cms']);
其中 url 是您在管理员中的“位置”值,而空数组是您可能想要传递的一些变量。
这有帮助吗?还是远方?