No me hago responsable si copiaste mal algún código que sale en las páginas de este sitio.
Ojalá sea de ayuda para más de alguno este sitio.
Se agradece si deja algún comentario.
Mostrando entradas con la etiqueta site template. Mostrar todas las entradas
Mostrando entradas con la etiqueta site template. Mostrar todas las entradas

martes, 5 de octubre de 2010

Plantillas de sitio nativas MOSS2007

http://blah.winsmarts.com/2007-7-All_you_ever_wanted_to_know_about_SharePoint_2007_Site_Templates.aspx


What are site templates?
Sometimes, you need to create the cutter for sites, so you can create cookie cutter sites easily. SharePoint comes with a few such cookie cutters out of the box. You might have seen this cookie cutter picker when creating a site/site collection etc. as shown below:

Those are usually site definitions (not Site Templates). I have covered the process of registering custom site definitions over here.
The obvious Q here is, How are Site Templates different from Site Definitions?
Site Templates vs. Site Definitions
  1. Site Templates are a LOT easier to create than Site Definitions. You can create a site template using point and click. Creating a site definition requires hand-coding a lot of XML files and other supporting files.
  2. Site templates serve a customized version of pages, i.e. low performance. Site definitions serve uncustomized pages, i.e. high performance. Thus you should choose site definitions over site templates, if a large number of sites will be created based on this cookie cutter.
  3. It is fairly easy to move around a site template. It is a tad bit (but not horribly more) complex to move around site definitions.
How to export a site to a site template?
Pretty darned easy. Go to http://<yoursiteaddress>/_layouts/savetmpl.aspx . Note: There is no  UI point and click that takes you to this URL for a site, so note this URL down.
You are presented with the following form.


Fill it out, and hit "OK". The template file (.stp) gets saved under the Site Template Gallery, which can be accessed by going to the Site Collection, Site Actions --> Site  Settings --> Modify All Site Settings, and clicking on the "Site Templates" link under the "Galleries" section. As you can see, the entire site got squeezed into a single .stp file (which is really a cab file). Quite impressive. :-)
How to register a site template inside a site?
AND
How to restrict certain sites to use only certain site templates?
Okay, so now you have created a cookie cutter for your site. The next obvious question is, "How can I use this cookie cutter?".
EASY!
a) You need to make sure that the site template exists on the site collection. This can be done by uploading an existing site template to the site template gallery. As mentioned above, the site template gallery can be found by going to the top level site in the site collection, then going to Site Actions --> Site  Settings --> Modify All Site Settings, and clicking on the "Site Templates" link under the "Galleries" section. Alternatively, you may also use the stsadm -o addtemplate command.
b) The next step is that you need to make this template uploaded in the gallery available to individual sites. So that is basically saying that Site A can use template X, but Site http://A/B can use only template Y. You would note for instance that out of the box, a publishing site lets you choose only "Publishing site with workflow" definition based sites as child sies. Well you can change that.
1. Just go to http://<yoursiteurl>/_Layouts/AreaTemplateSettings.aspx NOTE: Note down this URL :-), there is no point and click way of getting to at the site level. At a site collection level, you may use Site Settings -> Modify all Site Settings -> Page Layouts and Site Templates to reach the same page.
2. Pick the templates you'd rather have available as shown below:

.. and hit "OK". Now the appropriate site templates will show up in the cookie-cutter-picker. :-) w00t! 
Ummm .. thats about it as far as site templates go. Anything I missed re: Site Templates? Leave a comment or send me a message.

Registrar definición de sitio personalizado en MOSS2007 (site template)

http://blah.winsmarts.com/2006-12-Registering_your_custom_site_definitions_in_SharePoint_2007.aspx


Last night, Carl and I did end up recording the sequel to the first SharePoint 2007 DNRTV show we did earlier. In this episode, I had a chance to talk more about content types, and then I ran through a full-fledged example demonstrating an InfoPath Forms Services based solution solving a real life problem. And then after that I demonstrated creating KPI (key performance indicator) reports based on data collected via infopath forms running in a web browser.
All in all, the show I think, turned out quite well. I will blog about it when it is online.
But, that is not what this blog post is about. When Carl and I were recording, based on a conversation, I had alluded to the fact that you can create your own site definitions and register them within SharePoint 2007. How you ask? It’s a question of twiddling with a bunch of XML files. To which, of course the developer world comes to a screeching halt.
Yes, SharePoint does suffer from XMLITIS, but I have blogged about that as one of the criticisms, and let us get over that.
The real Q is, how can you, register your own site definitions. Well here is how.
1.
First you need a custom site definition. As you may be aware, a custom site definition is nothing but a logical grouping of features, lists, web parts, and a whole bunch of other things, that together make a site. For instance, I could create a custom site definition for a “Blog reader” application. (Speaking of which, in a week or two, the next issue of code-magazine will contain an article from me, demonstrating exactly how to create a blog-reader application a.k.a. bloglines/newsgator etc in SharePoint). All site definitions reside as a bunch of files at the following location.
C:\Program Files\Common Files\Microsoft Shared\web server extensions\12\TEMPLATE\SiteTemplates
(Note: I am almost done reviewing Scot Hilier’s upcoming Apress book on SharePoint 2007. He explains this very well in Chapter 11, and I strongly recommend you picking a copy of it – the book is simply excellent, and yes I will post a full review later).
Now in that directory, there are a bunch of site definitions already created. You can create one of your own, but since this blogpost doesn’t talk about that – go ahead and copy paste, “BLANKINTERNET” to a directory called “Sahil”
2.
Now ideally, the directory “Sahil” which contains the details of your site definition, should contain something meaningful in it – so a blogreader site definition will contain the necessary lists, features etc. But ignoring that, let us next look at, how you can register this new Site definition, in SharePoint.
Now at this path –
C:\Program Files\Common Files\Microsoft Shared\web server extensions\12\TEMPLATE\
You would note a curiously named directory called “1033”. 1033 is the culture number for en-us (US English). Under 1033\Xml, there are a bunch of XML files. Strangely enough, many of them are named as “WebTemp*.xml”. That is where you need to put this new site definition’s information, so SharePoint will understand it. Go ahead and copy paste webtempsps.xml and call the new file webtempsahil.xml. The name is important, since SharePoint will look for all files that match “WebTemp*.xml”.
3.
Now go ahead and edit the webtempsahil.xml file to look like as below.
<?xml version="1.0" encoding="utf-8"?>
<!--
 _lcid="1033" _version="12.0.4407" _dal="1" -->
<!--
 _LocalBinding -->
<
Templates xmlns:ows="Microsoft SharePoint">
  <
Template Name="Sahil" ID="10001">
    <
Configuration ID="0" Title="Sahil's site" Hidden="FALSE"                  ImageUrl="/_layouts/1033/images/IPPT.gif"                   Description="This is the custom site I was talking about."                  SubWebOnly="FALSE" DisplayCategory="Winsmarts">    </Configuration>
  </
Template>
</
Templates>
A few things that will jump out at you from the above XML file.
  - ID must be greater than 10000, so your IDs don’t screw up SharePoint’s.
  - You have a whole bunch of other control from the various possible elements, I think the above are self-explanatory.
4.
Now go ahead, and do an iisreset, and try creating a site collection under SCAW (SharePoint Central Web Administration), or a site under a site collection through various means. You should see something like the following in the page that prompts you to create new sites:
Sharepoint 2007 Site Definition 
Note that the text, the image, and everything else has been picked from WebTempSahil.xml.
Now how cool is that J!!? Now you can merrily create your custom site definitions, register them, and create them on a per-demand basis.
In further blog posts, I will cover various other aspects of Site Definitions. Until then, Rock On!!