Umbraco’s terms used may be unfamiliar to you like it does to me. The followings are some translations to help myself understand Umbraco perspective as a CMS.
In such a CMS, a web application is seen as a set of the contents (called documents) and the content UIs (called templates) which display the contents.
A content is defined as a set of properties, which have values. To be close to programming, we can think of it as variables.
A web application is a set of many contents which can be arranged in a hierarchy manner – called the content tree of the website.
An UI is just an HTML file where variables lie in here and there. Sometimes, we need to have an expression of the variables rather than the sole variables – this is when the macro comes into play. The macro’s output is a bunch of HTML, plotted by variables together with XSLT expressions (the ones who search for and manipulate variables among the content tree).
That’s just it.
To define a content, we use document. A document is of a particular document typewhich includes information about: 1) the variables ‘s definition which can be grouped into tabs, 2) the templates (the allowed/default ones) used to display the variables, 3) which child nodes are available to use when manipulating the content-tree.
There are two types of variables: user-defined variables and built-in variables. The built-in ones are prefixed by @.
A template can have a master template – this is a way Umbraco support making websites use a common master theme. Master & normal(non-master) templates are all HTML text except this difference: 1) a <asp:placeHolder id=”phID”> is defined in the master – it is where the non-master template ‘s HTML will be displayed. 2) a<asp:content contentPlaceHolderID=”phID”> is defined at the begining of the HTML script to indicate what master template it uses (i.e. the phID one).
When editing the template, sometimes you need an “HTML-function” that generates HTML script given the content XML tree. In Umbraco, we have such “functions” asmacros. Macros define HTML-fuction by using XSLT files.
As we know, an XSLT file takes input as an XML text and then manipulate the XML elelment (e.g. select the element nodes using XPath, looping through the nodes list, …) to convert it into HTML script. Here in Umbraco, whenever a macro is called inside a template T, the macro’s XSLT file is called along with its input set as the content XML tree. This XSLT file is also passed a parameter named currentPage which stored T-representing content node ‘s XPath. The script in XSLT file that starts using this passed parameter is the line: <xsl:param name=”currentPage”/>. Since then, we can access this xpath value by using $currentPage.