Return the page title
<%= title %>
Return the page description
<%= description %>
Return a comma seperated list of tags
<%= keywords %>
Returns the site name
//Full site name
<%= site_name %>
//Site name without whitespace
<%= site_name_one_word %>
//site name with non-ascii characters and whitespace replaced with hyphens
<%= site_name_clean %>
Return current year
<%= now.year %>
Editable Regions define areas of a template that can have their content set by a user of Blocks. Blocks offers the following Editable Regions:
- Text region
:textual
- Link region
:link
- Image region
:image
- Media region
:media
Declare the type of region to render: <%= render :region_type
Set the unique name of the region: <%= render :region_type => 'unique_name'
Each variable name must be unique within its document. Region names are restricted to alphanumerics and underscores. Hyphens will not work.
Most regions allow for default content to be set, using the :default
property, exceptions are link regions (see below)
For single-line raw text input.
Allows character limits using :maxlength
property.
<%= render :textual => 'region_name', :default => 'Lorem Ipsum', :maxlength => '100' %>
For TinyMCE wysiwyg text input.
Set by defining :type => :multi
<%= render :textual => ' region_name ', :default => "<p>Lorem Ipsum</p>", :type=> :multi %>
For multi-line text input, without a wysiwyg editor.
Set by defining :type => :multi
and :wysiwyg => false
<%= render :textual => ' region_name ', :default => "<p>Lorem Ipsum</p>", :type=> :multi, :wysiwyg => false %>
Allows images to be uploaded, but restricts images to an exact pixel dimension. Blocks provides image cropping for images that exceed the set dimensions.
Default placeholder image is set using the :default
property.
<%= render :image => 'region_name', :default => "http://placehold.it/400x200", :width => 400, :height => 200 %>
Variable Width and/or height range can be specified using the following syntax :width => 100..200
<%= render :image => 'region_name', :default => "http://placehold.it/400x200", :width => 100..600, :height => 100..400 %>
Note that width dimensions can be fixed, while height is variable and visa versa.
Media Regions follow the same rules as Image Regions, but allow for images, video or swf files to be uploaded.
<%= render :media => 'region_name', :default => "http://placehold.it/400x200", :width => 100..600, :height => 100..400 %>
Link regions allow extra properties:
:text
:title
:new_window
Boolean:link_kind
:link_value
:subject
<%= render :link => "region_name", :text => "Default Link Text", :link_value => '#', :text_editable => true %>
Link regions also allow for in-line attributes using the :html
property. Particularly useful for styling EDMs
<%= render :link => " region_name", :text => "Default Link Text", :link_value => '#', :text_editable => true, :html => { :style => "margin: 20px;", :align => 'right'} %>
For link regions that don't contain text, but rather, wrap blocks of content, including other editable regions, employ the following syntax:
<% render :link => 'region_name', :text_editable => false do %>
<!-- HTML content goes here. Other editable regions, ie. Image Regions can also go here -->
<% end %>
Blocks allows for sections of content, including editable regions to be repeated by users. Control over the maximum repeats is handled by the :max_repeats
property.
<% render :region => 'region_name', :max_repeats => 5 do %>
<!-- HTML content / Blocks editable regions go here.
NB: You CANNOT have repeating regions inside repeating regions -->
<% end %>
Blocks allows for 3 types of includes:
Navigation includes are intrinsically linked to a Navigation Set and a Navigation Template
Rendering a Navigation Template called main.nav
that reads its data from the Navigation Set called Main
is written as follows:
<%= render :navigation => "Main", :template_name => 'main.nav' %>
Global Widgets allow for a global template to be included across multiple sites.
<%= include_widget("widget_name") %>
Site Widgets allow for a template to be included across multiple templates, within a single site.
<%= include_site_widget("widget_name") %>