Kentico中门户模板和ASPX模板的区别
Kentico 中的门户模板和 ASPX 模板有什么区别?
哪个更可取?
What is the difference between portal template and ASPX template in Kentico?
Which is preferable?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
作为一名“硬核”开发人员和经过认证的 Kentico 培训师,我始终使用并始终推荐使用 Portal Engine,而不是 ASPX 模板。
我这么说是因为 Portal Engine 为创建内容提供了丰富的 UI并配置模板。您可以直接在 CMS Desk 中创建模板并向其中添加 Web 部件。您还可以获得一个漂亮的属性编辑器对话框,其中包含每个字段类型的自定义选择器,以及每个字段的宏编辑器。这意味着,如果某个字段需要文档类型列表,则“Portal Engine 属性”对话框将向您显示带有复选框的文档类型列表。这再简单不过了。
另一个主要区别是(至少目前),ASPX 模板开发方法不支持小部件。我不确定这种情况是否会在今年某个时候推出的 6.0 中发生改变。
另一个巨大的好处是经过适当培训的内容管理员能够对模板进行编辑。同样,如果他们经过适当的培训,他们可以在 CMS Desk 的设计选项卡中编辑模板。这可以减轻许多通常对开发人员来说是多余的工作。想一想:“嘿,Dev,你能更改此模板上的静态文本吗?”或“嘿 Dev,您可以将此 Web 部件移动到另一列吗?”。
唱反调,以下是 ASPX 模板的好处。模板基本上是母版页,因此它们基于文件,可以轻松地与源代码管理结合使用。这可能更适合代码较多的站点(应用程序),其中模板的配置至关重要。
使用 ASPX 模板可能会更容易编写更复杂的代码。例如,如果一个 Web 部件(用户控件)直接依赖于另一个 Web 部件的状态,则使用 ASPX 模板可以更轻松地实现这一点。但您也可以认为您的代码应该更加解耦,而不是依赖于模板中存在的其他 Web 部件 :P
As a "hardcore" developer and Certified Kentico Trainer I always use and always recommend the use of the Portal Engine over the ASPX Templates.
I say that because the Portal Engine gives a rich UI for creating and configuring templates. From directly within the CMS Desk you can create templates and add web parts to them. You also get a nice property editor dialog with custom selectors for each field type, as well as the macro editor for each field. That means that if a field is expecting a list of document types, the Portal Engine Properties dialog will show you a list of document types with check boxes. It couldn't get easier.
One other major difference is that (at least at this time), the ASPX template development method does NOT support widgets. I'm not sure if that will be changing in 6.0 which is supposed to debut sometime this year.
Another huge benefit is that properly trained content administrators have the ability to make edits to the templates. Again, if they're properly trained, they can edit the template in the design tab in the CMS Desk. That can alleviate a lot of work that normally is overkill for a Developer. Think: "Hey Dev, can you change the static text on this template?" or "Hey Dev, can you move this web part to the other column?".
To play devil's advocate, here are the benefits of ASPX Templates. The Templates are basically master pages, so they are file based and can be easily used in conjunction with source control. This may be a better fit for a code-heavy site (application) where the configuration of the templates is critical.
With ASPX templates it might be easier to write more complex code. For example, if one web part (User Control) directly depends on the state of another web part, then this would be more easily accomplished using ASPX Templates. But you could also argue that your code should be more decoupled and not rely on other web parts existing in the template :P
可以在Web界面内构建门户模板;它们具有复杂但强大的继承结构;组合和显示数据的方法有很多种,但在很多地方必须管理/操作数据才能使其正常工作。
ASPX 模板允许更复杂的代码并直接通过 Visual Studio 或类似编辑器进行编辑。
两种型号可以一起使用。您可以使用其中任何一个来完成大多数事情。因此,这实际上取决于您自己的开发偏好、技能组合和/或具体情况的解决方案需求。
就我个人而言,我在更复杂的网站上混合使用两者。我使用门户模板来构建简单的网站,因为无需完整的发布/发布周期即可远程进行简单的更改,速度更快。
点击长版本的链接,但是来自 Kentico DevNet“ASPX 与 Kentico CMS 中的门户引擎开发”博客文章是:
Portal templates can be built within the web interface; they have a complicated but robust inheritance structure; many ways to combine and show data, but there are a lot of places one has to manage/manipulate data to get them to work just right.
ASPX template allow for more complicated code and editing via Visual Studio or similar editor directly.
Both models can be used together. You can accomplish most things with either. So it really comes down to your own development preference, skill sets, and/or solution needs on a case-by-case basis.
Personally, I use a mix of the two on more complicated sites. Simple sites I get by with portal templates since it is quicker to make simple changes remotely without a full publish/release cycle.
Follow the link for the long version, but the 'short version' from the Kentico DevNet "ASPX versus Portal Engine development in Kentico CMS" blog post is:
我发现使用 ASPX 模板时的一大优势是它们是基于文件的,因此源代码控制非常容易,并且在进行更改时我可以轻松地从本地部署到开发再到生产环境。使用门户模板,如果您进行更改,它们都会存储在数据库中,并且将它们部署到不同的环境中会更加复杂(除非您设置了数据库源代码控制)。您必须对门户模板进行更改,然后在其他环境中恢复数据库或其他内容!
One big advantage I found when using ASPX templates is that they were file based, so source control was really easy, and I could deploy from local to development to production environment easily when making changes. With portal templates, if you make changes, they are all stored in the database, and its more complicated to deploy them to different environments (unless you have database source control set in place). You would have to make changes to the Portal templates, and then restore your database or something on the other environments!