1

我有一个想法,将编辑层添加到网站作为Plack 中间件

解释:假设我们创建了一个网站,基于一些框架和模板和 CSS(请求它像/some/page)。现在我们可以创建一个中间件,以便对以adm(like /adm/some/page) 开头的页面的每个请求都显示相同的页面,但添加了一个用于内容编辑的层。所以我们可以像访问者一样轻松地查看和使用页面,但是通过双击块级元素,我们可以修改或添加内容。所以中间件应该将某些块元素与某些事件(双击)绑定并设置处理程序(使用一些 Javascript 库)。

目前这只是一个想法,我还没有在任何 CMS 中看到这种方法。我正在寻找提示、想法和示例,如何启动和实施这样的系统。我希望,已经有类似的事情发生了。

4

1 回答 1

1

You could do it, but I don't think you want to do this. My understanding is that Plack::Middleware's are supposed to be generic, and implementing a CMS as a plack middleware limits its re-usability, and its out of place, there is no inherent connection between a middleware and a CMS.

See these as examples Plack::Middleware::OAuth, Plack::Middleware::Debug, Plack::Middleware::iPhone, Plack::Middleware::Image::Scale, Plack::Middleware::HTMLMinify

It would be trivial to add a middleware filter to insert a form in your html based on /adm/ or /admin/ or whatever ... and mapping the url to the dispatch would highly depend on the underlying CMS model/view/controller framework, which is why frameworks such as Catalyst, Mojolicious and other already provide this feature

See http://advent.plackperl.org/2009/12/day-23-write-your-own-middleware.html Basically, I think this is a job for a view/controller of your application, a plugin, not a wrapper for your application (middleware)

I know my explanation is lacking but hopefully you catch my drift

于 2011-10-11T10:12:22.407 回答