- Removed duplicated content from page-type-templates (was more or less a variation of the content in templates.md)
- Removed built-in page-controls, which was a bit of a dumping ground for unconnected topics.
Moved the majority to page-type-templates
- Removed all recipes from "sitetree" docs, since they were outdated or hacky (like grouping of records, or implementing custom *children() method on subclasses)
- Added pagination, escaping, base_tag, CurrentMember to template docs
- Removed default_parent docs from SiteTree, as this setting doesn't have any effect looking at core

-* section: A child of this page is currently open, which means that we're currently in this section of the site.

-* current: This page is currently open.

-

-A useful way of using this is in your menus. You can use the following code below to generate class="current" or

-class="section" on your links. Take the following code

-

- :::ss

- <li><a href="$Link" class="$LinkingMode">$Title</a></li>

-

-

-When viewed on the Home page it will render like this

-

- :::ss

- <li><a href="home/" class="current">Home</a></li>

-

-

-`$LinkOrCurrent` ignores the section status, returning link instead. `$LinkOrSection` ignores the current status, returning section instead. Both of these options can simplify your CSS when you only have 2 different cases to consider.

-

-####<% if LinkOrCurrent = current %>

-

-This is an alternative way to set up your menus - if you want different HTML for the current menu item, you can do

-something like this:

-

- :::ss

- <% if LinkOrCurrent = current %>

- <strong>$Title</strong>

- <% else %>

- <a href="$Link">$Title</a>

- <% end_if %>

-

-

-####<% if LinkOrSection = section %>

-

-Will return true if you are on the current page OR a child page of the page. Useful for menus which you only want to

-show a second level menu when you are on that page or a child of it

-

-####<% if InSection(page-url) %>

-

-This if block will pass if we're currently on the page-url page or one of its children.

-

-###Titles and CMS Defined Options

-

-####$MetaTags

-

-This returns a segment of HTML appropriate for putting into the `<head>` tag. It will set up title, keywords and

-description meta-tags, based on the CMS content. If you don't want to include the title-tag (for custom templating), use

-**$MetaTags(false)**.

-

-####$MenuTitle

-

-This is the title that you should put into navigation menus. CMS authors can choose to put a different menu title from

-the main page title.

-

-####$Title

-

-This is the title of the page which displays in the browser window and usually is the title of the page.

-

- :::ss

- <h1>$Title</h1>

-

-####$URLSegment

-

-This returns the part of the URL of the page you're currently on. Could be handy to use as an id on your body-tag. (

-when doing this, watch out that it doesn't create invalid id-attributes though.). This is useful for adding a class to

-the body so you can target certain pages. Watch out for pages named clear or anything you might have used in your CSS

-file

-

- :::ss

- <body class="$URLSegment">

-

-

-####$ClassName

-

-Returns the ClassName of the PHP object. Eg if you have a custom HomePage page type with `$ClassName` in the template, it

-will return "HomePage"

-

-####$BaseHref

-

-Returns the base URL for the current site. This is used to populate the `<base>` tag by default, so if you want to

-override `<% base_tag %>` with a specific piece of HTML, you can do something like `<base href="$BaseHref"></base>`

-

-###Controlling Members and Visitors Data

-

-####<% control CurrentMember %>, <% if CurrentMember %> or $CurrentMember.FirstName

-

-CurrentMember returns the currently logged in member, if there is one. All of their details or any special Member page

-controls can be called on this. Alternately, you can use `<% if CurrentMember %>` to detect whether someone has logged

-in. To Display a welcome message you can do

-

- :::ss

- <% if CurrentMember %>

- Welcome Back, $CurrentMember.FirstName

- <% end_if %>

-

-

-If the user is logged in this will print out

-

- :::ss

- Welcome Back, Admin

-

-

-####<% if IsRepeatMember %>

-

-Detect the visitor's previous experience with the site. `$IsRepeatMember` will return true if the visitor has signed up or logged in on the site before.

-

-Note that as of version 2.4 `$PastVisitor` is deprecated. If you wish to check if a visitor has been to the site before, set a cookie with `Cookie::set()` and test for it with `Cookie::get()`.

-

-Note that in 2.4 this variable was called `$PastMember`. This still works in 3.0 but is deprecated.

-

-###Date and Time

-

-####$Now.Nice, $Now.Year

-

-`$Now` returns the current date. You can call any of the methods from the [api:Date] class on

-it.

-

-####$Created.Nice, $Created.Ago

-

-`$Created` returns the time the page was created, `$Created.Ago` returns how long ago the page was created. You can also

-call any of methods of the [api:Date] class on it.

-

-####$LastEdited.Nice, $LastEdited.Ago

-

-`$LastEdited `returns the time the page was modified, `$LastEdited.Ago` returns how long ago the page was modified. You

-can also call any of methods of the [api:Date] class on it.

-

-###DataObjectSet Options

-

-If you are using a DataObjectSet you have a wide range of methods you can call on it from the templates

-

-####<% if Even %>, <% if Odd %>, $EvenOdd

-

-These controls can be used to do zebra-striping. `$EvenOdd` will return 'even' or 'odd' as appropriate.

-

-####<% if First %>, <% if Last %>, <% if Middle %>, $FirstLast

-

-These controls can be used to set up special behaviour for the first and last records of a datafeed. `<% if Middle %>` is

-set when neither first not last are set. `$FirstLast` will be 'first', 'last', or ''.

-

-####$Pos, $TotalItems

-

-`$TotalItems` will return the number of items on this page of the datafeed, and `$Pos` will return a counter starting at 1.

-

-####$Top

-

-When you're inside a control loop in your template, and want to reference methods on the current controller you're on,

-breaking out of the loop to get it, you can use `$Top` to do so. For example:

-

- :::ss

- $URLSegment

- <% control News %>

- $URLSegment <!-- may not return anything, as you're requesting URLSegment on the News objects -->

- $Top.URLSegment <!-- returns the same as $URLSegment above -->

- <% end_control %>

-

-

-##Properties of a datafeed itself, rather than one of its items

-

-If we have a control such as `<% control SearchResults %>`, there are some properties, such as `$SearchResults.NextLink`,

-that aren't accessible within `<% control SearchResults %>`. These can be used on any datafeed.

-

-###Search Results

-

-####<% if SearchResults.MoreThanOnePage %>

-

-Returns true when we have a multi-page datafeed, restricted with a limit.

-

-####$SearchResults.NextLink, $SearchResults.PrevLink

-

-This returns links to the next and previous page in a multi-page datafeed. They will return blank if there's no

-appropriate page to go to, so `$PrevLink` will return blank when you're on the first page. You can therefore use

-`<% if PrevLink %>` to keep your template tidy.

-

-####$SearchResults.CurrentPage, $SearchResults.TotalPages

-

-CurrentPage returns the number of the page you're currently on, and TotalPages returns the total number of pages.