0

CMS (および codeIgniter) を使い始めました。言語のためにFuelCMSを選択しました...

これまでのところ、問題なく動作しています。ページ、言語などを処理するコントローラーがあります。

ビューの下にページの階層を作成しました。

de/page1

de/page2

イギリス/ページ1

イギリス/ページ2

しかし今、そのページの特定のコンテンツを編集したいと考えています。ヘッダーとフッターの 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 でページを表示し、ページのコンテンツ部分のみを編集できるようにするにはどうすればよいですか?

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 で作成すると、ページ上部のレイアウト 1 の下に「言語」の選択が表示されます。これが、同じレイアウトに異なる言語コンテンツを設定する方法です。

この 2 つのページは次のように作成されます。 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 に答える