what is difference between site definition and web template? - sharepoint

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

Related

How to put a web part from one site to another in SharePoint?

There are two SharePoint sites, each based on its own SharePoint installation.
Both are in the same domain.
The first site is for a document flow.
The second site is for a knowledge base.
I need to put a set of web parts (search, search results, indexed document library) from the second site in the master page of the first site.
The services and data will stay on the second site but they would be available in the first site.
I tried to apply the Page Viewer Web Part but it’s impossible to avoid using the second site’s master page layout.
Question
What other ways exist to solve this task?
You can index content of first SharePoint farm with search service application in another SharePoint farm.
You should configure search service application and add new website content source in search service application setting.
In this scenario you dose not need to move any thing and SharePoint crawl your content periodically.

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...

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

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

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

Creating Site Templates from MOSS publishing sites

I know that creating a site template from a MOSS publishing site is not currently supported by Microsoft.
Can anyone tell me if creating a basic site, then turning on the publishing feature, then creating a site template is supported - I would guess not as it's probably the same as creating a publishing portal?
You can staple the publishing feature onto your site template.
From KB 986908:
You can create a stapling feature to staple the Office SharePoint Server Publishing feature to specific site templates. For example, see the Feature.xml file in the "Drive:\Program Files\Common Files\Microsoft Shared\Web server extensions\12\Template\Features\PublishingStapling" folder. To staple the Office SharePoint Server Publishing feature to all site templates, use the TemplateName="GLOBAL" property. This property staples a particular feature to a site definition if the site definition does not specify the AllowGlobalFeatureAssociations property. (Only the Shared Services Provider site template and the Blank Site site template use the AllowGlobalFeatureAssociations="FALSE" property.)
For example, when you use the TemplateName="GLOBAL" property to staple the Office SharePoint Server Publishing feature, a site that is based on the Team site template uses the system master page that is configured for the root site of the site collection.
you can still access the save template webpage, and save it...
for example http://localhost/website/_layouts/savetmpl.aspx
and it works like a charm :-)
I don't think what you're describing will work (like you said, it's basically the same thing as a Publishing Portal), but there appears to be a workaround. According to this post from the SharePoint Solutions Team (apparently not related to Microsoft), you can create a publishing site, customize it as needed, deactivate the publishing feature, create a site template from it, create a new site based on the template, and then activate the publishing feature on your new site.
It sounds like this works, but is not officially supported by Microsoft. Be careful, since it may mostly work, but I wouldn't be surprised if some small pieces of it break.
We wrote our own tooling to solve the export problem. We can create site columns, content types, master pages, page layouts etc in the Publishing site, and export selected items to a WSP package for deployment to other servers.
The tool SPSource takes a similar approach, but creates a Visual Studio solution for compilation. The result can be packaged with WSPBuilder.

Resources