Helpers

To make your life as a template developer even easier, there are some handy helper functions

url($uri)

If you want to echo a page url in your templates without using an absolute url you can use the url() function like this:

span class="st0">'projects/project-1'

It will take care of always returning the right absolute url.
If you need it even shorter, go for:

span class="st0">'projects/project-1'

thisURL()

Sometimes it's nice to get the current url without much hassle. That's what thisURL() is for:

 

home()

Redirects the user to the homepage

 

notFound()

Redirects the user to the error page

 

css($url, $media='all')

This is just a shortcut for your templates to easily embed stylesheet files:

span class="st0">'styles/styles.css'

You can also use this with absolute urls

span class="st0">'http://example.com/some/styles.css'

js($url)

This is another shortcut for your templates to easily embed javascript files:

span class="st0">'javascript/jquery.js'

You can also use this with absolute urls

span class="st0">'http://example.com/some/scripts.js'

youtube($url, $width=false, $height=false)

Emebed a Youtube url as video

span class="st0">'http://www.youtube.com/watch?v=iUCDhvbQFmU'

vimeo($url, $width=false, $height=false)

Emebed a Vimeo url as video

span class="st0">'http://vimeo.com/33091687'

flash($url, $width=false, $height=false)

Emebed any flash video file

span class="st0">'http://yourdomain.com/flash.flv'

twitter($username, $text=false)

Add a link to a Twitter profile

span class="st0">'getkirby'