What is the di开发者_开发知识库fference between portal template and ASPX template in Kentico?
Which is preferable?
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
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:
If you don't know the development models, or if you are not that experienced developer, and if you want your web site to be developed quickly, choose the Portal Engine. If you don't like design modes and visual programming, but like writing your code by yourselves, choose ASPX model (ASPX page templates).
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!
精彩评论