0

我开始使用 CMS(和 codeIgniter)。我选择 FuelCMS 是因为语言,...

到目前为止,它工作正常。我有一个控制器来处理页面、语言、..

我在视图下创建了页面层次结构:

de/page1

de/page2

英国/page1

英国/page2

但现在我想编辑该页面的具体内容。我有两个一直在使用的块:页眉和页脚。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 中显示页面并只让他们编辑我页面的内容部分?

4

1 回答 1

0

我没有 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 是您在管理员中的“位置”值,而空数组是您可能想要传递的一些变量。

这有帮助吗?还是远方?

于 2015-10-07T01:44:02.353 回答