何时构建应用程序/类与模块?
我对 Kohana 还很陌生,但我喜欢这个框架。我遇到了一个问题,我需要在我的应用程序中构建一个主题系统。它在很大程度上是特定于应用程序的,并且确实没有任何理由来共享它。最初我将其构建到 Kohana 内的模块系统中,但现在需要扩展它。我还没有看到太多关于它的参考,但最好的做法是将所有像这样的支持类构建到模块中,还是将特定于应用程序的类等保存在应用程序/类中?
顺便说一句,Kohana 有什么好的主题系统示例吗?我真的很喜欢 Drupal 管理其主题和子主题的方式,并且希望在我的应用程序中模拟一个非常基本的版本。
I'm fairly new to Kohana but I like the framework. I've hit a bit of an issue where I need to build a theme system into my application. It is very much application specific and there really won't be any reason to share it down the track. Initially I built it into the modules system within Kohana but now need to expand it. I haven't seen much reference for it but is it best practice to build all support classes like this into the modules or is it best practice to keep application-specific classes etc housed within application/classes?
On a side note, are there any good theme-system examples for Kohana? I really like how Drupal manages its themes and sub-themes and was wanting to emulate a very basic version of this inside my application.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我同意这一点,任何特定于应用程序并且没有真正重用的内容都应该放入应用程序目录中。我喜欢将模块用于相当通用的模块。示例如下:
等等...
对于您的情况,您可能会考虑构建一个模板引擎并将其放入模块中(它是通用的),然后只需将应用程序特定主题放入应用程序目录中,您的模块可以在其中加载和使用它。
I'd agree with that, anything specific to the application and has no real reuse should be put into the application directory. I like to use modules for fairly generic modules. Examples would be:
etc ...
For your case, you might consider building a templating engine and putting that into a module (it's generic), then simply housing the application specific theme into the application directory where your module can load and use it.