ruby-on-rails - Yii:如何在 View 中定义局部布局?

标签 ruby-on-rails view yii

在 Rails 中很容易:

View 有:

<% content_for :sidebar do %> ... sidebar HTML ... <% end %>

布局有:

<%= yield :sidebar %>

我可以在 Yii 中做同样的事情吗?

更新:如何在 main.php 布局中同时使用动态页眉、内容和页脚?

最佳答案

View 有:

<?php $this->beginClip('sidebar'); ?>
Hi there!
<?php $this->endClip(); ?>

布局有:

<?= $this->clips['sidebar'] ?>

更多信息请查看 CController 文档。

但平心而论,这是做侧边栏的错误方法。

关于ruby-on-rails - Yii:如何在 View 中定义局部布局?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8116032/

相关文章:

javascript - 如何解决这个 "Uncaught TypeError: Cannot convert undefined or null to object "

php - Yii 向 CGridView 中的虚拟属性添加过滤器并使其可排序

php - 如何在 Laravel 5 中检索 View 名称?

ios - swift 错误 : "...whose view is not in the window hierarchy." performseguewithidentifier

php - 如何解决 php 5.5 yii 框架中的非静态方法

php - yii语言本地化mysql表数据进入 View

css - 如何将 glyphicon 添加到 bootstrap 下拉菜单

ruby-on-rails - Ruby 从数组中减去一个数

ruby-on-rails - Ruby on Rails 日志行以 "I"或 "W"开头

sql - 如何重写 SQL xpath 查询以创建索引 View