What is the main differences between site definition and site template? - sharepoint

What is the main differences between site definition and site template?

A site definition is the basic blueprint for a site, including how it looks, what lists it contains, default navigational structures, and so on. You normally create a site definition by hand-editing CAML.
A site template can be created from within the Sharepoint application, and is basically a "diff" between the site definition and any changes made since the site was created. A site template is based on the underlying site definition, which means that if you create a new site from a template, and later change the underlying site definition, you run the very real risk of irreversibly screwing up your site.
A best practice is to configure a minimal site definition that, once created, is never modified again, and use site templates to store reusable customizations.

Feature Stapling
Site Definition: Supported
Site Template: Not supported
Multiple webs
Site Definition: Can provision multiple webs.
Site Template: Can only provision one web.
Complexity
Site Definition: Complex to create
Site Template: Easier to create
Permissions
Site Definition: Requires admin access to server for deploying.
Site Template: Installable from a Web UI by site owners.
Performance
Site Definition: Files are on disk, better performance.
Site Template: Files are in database, less efficient.

There are lots of main differences. Depends on what you are looking for:
Deciding Between Custom Web Templates and Custom Site Definitions:
http://msdn.microsoft.com/en-us/library/aa979683.aspx

Related

Is it posible to do app for SharePoint that create another site and create a list and libraries on this other site?

I want to create my first SharePoint App. I am wondering, is it possible to create an app which will create SharePoint site and will build a structure (with a few lists and libraries) on this site?
Yes is possible. It depends what are your business requirements. I mean based on what rules you want to create the site (SPWeb)? Most likely you would need to create a WebPart (which is similar to a UserControl ASCX in ASP.NET) and put there the interaction with user. Then, if the sites to be created has usually the same lists and libraries and so on I would suggest you to create a Web template which contains these things and then simply create a Site based on that web template...
I can provide you some further examples if you want...

What is the use case for a "Mixed" ASPX+ Portal page template?

Reading this question regarding using portal engine vs. aspx, there is also the option for a "Mixed" template which the training defines as:
This page template is based on an ASPX page located in the path specified in the File name field. ASPX+ Portal page templates are based on an ASPX page with additional page components that enable the Design tab.
What isn't clear is what the use case is for this mixed template. When would you use this versus the other two?
Update
I read the following in the Developer Training materials:
Sometimes, you may need to combine ASPX page templates or external ASPX pages with
Portal Engine page templates on a single web site. When developing or maintaining a
web site built on ASPX page templates, you must manually modify the code of a page
every time you want to change its design. But you can add flexibility to ASPX templates
by defining areas that can be edited directly through the browser using the CMS
administration interface (similar to the Portal Engine development model).
This explains clearly that it is a true hybrid where you have both ASPX template and Portal Engine functionality, but it isn't clear what benefit you have by using this approach versus a Portal Engine template that utilizes widgets or web parts.
I'd say there is no "benefit" as such. You can use this mode e.g. when you are migrating existing ASPX web site to Kentico portal engine pages and replacing components (such as controls and web parts) one by one. When you finish the migration you can switch to portal engine mode. The goal was to provide this functionality for those who need it. It is recommended to use portal engine as you have complete control over the pages from CMS Desk.
The most common place I use them is when adding templates to a site using ASPX page templates, usually sites tend to have a content page, where I can swap out the controls (usually editable regions) with web part zones, then use that one template file to create multiple ASPX + Portal templates.
That way I can add a lot of new functionality into an existing site, without having to create half a dozen new .aspx templates.
I imagine it's also still useful for a new project where you want to keep your templates under source control, while utilizing the portal engine/web part functionality of Kentico.

what is difference between site definition and web template?

Yesterday in one interview they asked what is difference between site definition and web templates? Really I was confused. Can any one tell me the differences? I googled but not got the specific answer.
Site definition affects an entire site collection created from it.
Web template is site-scoped.
Site definitions consist of files stored on a front-end web server in folders under the \(14 hive)\TEMPLATE\SiteTemplates directory.
Web templates are stored in the database.
Web templates are based on existing sites, so they depend on the site definition used to create their base site.
More information: Site Types: WebTemplates and Site Definitions

How to force users to use specific custom template for meeting workspaces?

I have a calendar on a SharePoint 2010 site and I have created a custom site template based on the standard meeting workspace. I'd like to force users to only be able to use my custom template.
One option is to add Hidden="TRUE" in webtemp.xml for all other meeting workspace templates - this will leave mine as the only option. This, however, works on the farm level and I'd like to keep the templates available for other web applications. If I can do this on a web application or lower level it will do the trick.
Even better solution - if I can make the new event dialogue skip the step altogether and use my template without asking.
Background:
My custom template only contains security customizations, no UI or content changes. I want to impose it as I have requirements for the permissions of the meeting workspaces which are different from the parent site - so inheritance has to be broken. But I can't think of another way to supply default permissions other than by using a site template for the workspace.
Site Settings > Look and Feel > Page Layouts and Site Templates
choose the site templates you want to be used in the site, this can inherit all the way down the site collection or you can start in a subweb.

Site Template and Master pages

I am a .net developer and want to learn SharePoint. Usualy we use MasterPages to have a constant layout for all or some of the pages. My confusion here is SharePoint uses Site Template and MasterPages which both sounds to do same thing. am I right?
thanks
MasterPages and Site templates are absolutelly different thing. Master page is usually layout of some pages. It's same like in ASP.NET.
In Sharepoint you can create some sites in site collection. These sites are created according to site template. When you creating (for example) team site, it's created according to team site template, which is stored in Sharepoint folder on file system. In site templates you can specify which features should be activated when site is created, which features should be activated on site collection scope etc. Also you can specify list, which should be created, modules... And also you can specify default master page which will be used on site.
You can find more informations on msdn

Resources