---
title: "Radiant_The Popular Ruby's CMS Demo篇"
author: "C_J"
date: "2011-04-02T14:49:55Z"
tags: []
categories: ["编程语言"]
slug: "radiant-the-popular-ruby-s-cms-demo"
draft: false
lastmod: "2012-10-22T00:08:33Z"
id: 984567
url: "https://c-j.iteye.com/blog/984567"
---

题记：

    [上篇](/topic/976947) 记录我第一次安装Rodiant经过和简单了解了Radiant后台的组织形式，随着不断深入，这篇就研究下Radiant的Demo吧。总体来说，Radiant分为Content & Design 2大块，Content是Page的内容，snippet就是代码段或小模块。如果说layout是骨架，snippet则是神经，Content就是血肉了，在snippet里可以实现你需要的小功能和效果，layout展现所有的snippet，Content显示文字内容部分。

 

**先看Layout布局**

    Demo用的默认normal布局，layout对于设计人员来说是最全局和宏观的设计，他不特定应用某一个page，可灵活配置于多个page，如下：

![](http://dl.iteye.com/upload/attachment/453257/b89d25b5-dc39-3df3-96e6-b77febf4e981.jpg)

Normal如下：

![](http://dl.iteye.com/upload/attachment/453272/86ebc538-9238-32ea-a073-a457a03def70.jpg)

 可以看到normal的layout整个分为了&lt;div id="page"&gt; & &lt;div id="footer-wrapper"&gt; 2部分，其中有2个重点，分别是：&lt;r:content /&gt;  & &lt;r:snippet /&gt;.

前者：

```
<r:content />
Renders the main content of a page. Use the part attribute to select a specific page part. By default the part attribute is set to body. 
```

 后者：

```
<r:snippet />
Renders the snippet specified in the name attribute within the context of a page.
```

 

Normal包含3个snippets：

&lt;r:snippet name="header" /&gt;  
&lt;r:snippet name="navigation" /&gt;  
&lt;r:snippet name="footer" /&gt;

 

先看header吧：

![](http://dl.iteye.com/upload/attachment/453282/817cd81f-b00d-3564-964f-1b59415ee19a.jpg)  
 其他2个都类似，navigation做所有的标题，这里可以运用JQuery来做个绚丽的navigation，得力于他开放代码式风格，这正式我需要的。

 

 

**再看看Content**

    在Normal主要的Content是 &lt;r:if\_content part="extended"&gt; 和  &lt;r:content part="sidebar" inherit="true" /&gt;，先看看Content在Homepage上有什么：

![](http://dl.iteye.com/upload/attachment/453309/6e6fe25d-2327-3822-8223-bcab6404b5a7.jpg)

中间的是显示Page里的HomePage的子内容body，右边的是HomePage的子内容sidebar，如下：

![](http://dl.iteye.com/upload/attachment/453305/b7d2ec80-be12-3ebf-9de9-d4a15a44e6ef.jpg)