ZURB基金会的CAKEPHP3布局尺寸

ZURB基金会的CAKEPHP3布局尺寸,cakephp,zurb-foundation,cakephp-3.0,cakephp-3.x,cakephp-3.2,Cakephp,Zurb Foundation,Cakephp 3.0,Cakephp 3.x,Cakephp 3.2,我想知道如何处理cakephp3中一个让我恼火的问题。我知道它使用一流的Zurb基金会布局。 如果我烘焙典型控制器的CRUD动作,我会得到4个视图文件。但每个视图文件有4个单独的布局尺寸 这里是一个添加视图 <nav class="large-3 medium-4 columns" id="actions-sidebar"> <ul class="side-nav"> <li class="heading"><?= __('Act

我想知道如何处理cakephp3中一个让我恼火的问题。我知道它使用一流的Zurb基金会布局。

如果我烘焙典型控制器的CRUD动作,我会得到4个视图文件。但每个视图文件有4个单独的布局尺寸

这里是一个添加视图

<nav class="large-3 medium-4 columns" id="actions-sidebar">
    <ul class="side-nav">
        <li class="heading"><?= __('Actions') ?></li>
        <li><?= $this->Html->link(__('List Users'), ['action' => 'index']) ?></li>
        <li><?= $this->Html->link(__('List Questions'), ['controller' => 'Questions', 'action' => 'index']) ?></li>
        <li><?= $this->Html->link(__('New Question'), ['controller' => 'Questions', 'action' => 'add']) ?></li>
    </ul>
</nav>
<div class="users form large-9 medium-8 columns content">
    <?= $this->Form->create($user) ?>
    <fieldset>
        <legend><?= __('Add User') ?></legend>
        <?php
            echo $this->Form->input('username');
            echo $this->Form->input('password');
        ?>
    </fieldset>
    <?= $this->Form->button(__('Submit')) ?>
    <?= $this->Form->end() ?>
</div>

这里是索引视图

<nav class="large-3 medium-4 columns" id="actions-sidebar">
    <ul class="side-nav">
        <li class="heading"><?= __('Actions') ?></li>
        <li><?= $this->Html->link(__('New User'), ['action' => 'add']) ?></li>
        <li><?= $this->Html->link(__('List Questions'), ['controller' => 'Questions', 'action' => 'index']) ?></li>
        <li><?= $this->Html->link(__('New Question'), ['controller' => 'Questions', 'action' => 'add']) ?></li>
    </ul>
</nav>
<div class="users index large-9 medium-8 columns content">
    <h3><?= __('Users') ?></h3>
    <table cellpadding="0" cellspacing="0">
        <thead>
            <tr>
                <th><?= $this->Paginator->sort('id') ?></th>
                <th><?= $this->Paginator->sort('username') ?></th>
                <th><?= $this->Paginator->sort('password') ?></th>
                <th><?= $this->Paginator->sort('created') ?></th>
                <th><?= $this->Paginator->sort('modified') ?></th>
                <th class="actions"><?= __('Actions') ?></th>
            </tr>
        </thead>
        <tbody>
            <?php foreach ($users as $user): ?>
            <tr>
                <td><?= $this->Number->format($user->id) ?></td>
                <td><?= h($user->username) ?></td>
                <td><?= h($user->password) ?></td>
                <td><?= h($user->created) ?></td>
                <td><?= h($user->modified) ?></td>
                <td class="actions">
                    <?= $this->Html->link(__('View'), ['action' => 'view', $user->id]) ?>
                    <?= $this->Html->link(__('Edit'), ['action' => 'edit', $user->id]) ?>
                    <?= $this->Form->postLink(__('Delete'), ['action' => 'delete', $user->id], ['confirm' => __('Are you sure you want to delete # {0}?', $user->id)]) ?>
                </td>
            </tr>
            <?php endforeach; ?>
        </tbody>
    </table>
    <div class="paginator">
        <ul class="pagination">
            <?= $this->Paginator->prev('< ' . __('previous')) ?>
            <?= $this->Paginator->numbers() ?>
            <?= $this->Paginator->next(__('next') . ' >') ?>
        </ul>
        <p><?= $this->Paginator->counter() ?></p>
    </div>
</div>

相似性: 若您查看两个代码示例的第一行,您将看到

<nav class="large-3 medium-4 columns" id="actions-sidebar">

此代码示例在两个视图中,实际上它也在编辑删除

维护4个视图: 通过在一个视图文件中将
large-3
值设置为
large-2
,意味着我必须对其他3个视图文件执行相同的操作

是否有某种方法可以对所有4个视图进行一次更改?我是不是遗漏了什么

解决方案是什么? 我如何才能保持一致的布局,而不必为自定义4个文件而头痛。
我知道我可以在其中粘贴一个元素,但这不是正确的解决方案?

您可以在AppView中设置类并在视图中回显它。

您打算在条件下动态更改导航元素的类还是更改烘焙模板?我只想找到一种不必一直修改4个视图的方法。

如果我决定调整布局元素的大小