开发者

Can I improve my module-skin architecture somehow?

I'm designing a CMS for a private project that should make the editing of the website simple. It supports modularism. However, it's still in beta, and I'm now asking if you can see something I could improve or if you have some entirely different approaches to this scenario.

First of all, I have "themes" that are a set of HTML, CSS and maybe JS. Each theme can contain different styles that are each in separate files (like full-width.html, fluid.html, etc). Then the admin can choose a different style for different pages. Some pages have only 1 column, some have sidebars, etc.

Current the way it works is that a style HTML looks like:

<html>
<body>
<div id="header">{block id="header"}</div>
<ul>
{blocks id="list"}

{block}
<li>
{content}
</li>
{/block}

{/blocks}
</ul>
</body>
</html>

The theme creator can place "blocks" which define where the admin can place modules. These modules can be just text, or contain more complex HTML like a shoutbox or a login form. Anyway, the blocks must all have ID's except for those that are inside another block. This way, when the admin decides where to place modules, he will get a form like:

 Header module: --select--
 List modules:
     --select--
     --select-- (automatically adds new selects as needed)

Where --select-- is a HTML select box containing all installed modules. The ID is used to make it easier for admin to understand where the selected module goes on the site without having to save changes and preview.

The theme creator is capable of placing multiple blocks with {blocks} tag. It means that the admin can place several modules within it, like in Wordpress you can have "tags", "login", "affiliates", etc lots of modules on the sidebar. The amount of modules can be restricted with {blocks limit="5"}. I could have some other settings, too.

If the block is specified on the page as {block id="header"} then it means the contents of the chosen module for the block will be substituted into it. However, if it's {block}{/block}, then the theme creator has to use {content} somewhere in between the tags开发者_StackOverflow社区 to specify the place for the content. He can also use {name} to specify the module's name, etc.

In overall, are there some improvements I could do on this? Do you have any suggestions?

And most importantly, am I trying to redesign an already existing mighty modular system that I should use instead?


Look at this article about Facelets. It doesn't matter if you are not a java guy. Just look at facelet constructions in the middle of the article.

In practice these constructions are very convenient so maybe you'll find there something that you'll want to provide with your cms.


am I trying to redesign an already existing mighty modular system that I should use instead?

I can think of two that fit the description: Struts with Tiles, and the web based service squarespace.


Have a look into NVelocity from the Castle stack it is very powerful and it looks like you are trying to reinvent the wheel a little.

http://www.castleproject.org/others/nvelocity/index.html

I hope this helps.


Checkout django's template system

http://docs.djangoproject.com/en/dev/topics/templates/#topics-templates

http://docs.djangoproject.com/en/dev/ref/templates/api/

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜