NAME

BSE::Variables - commonly set variables


SYNOPSIS

  # in perl code
  require BSE::Variables;
  $foo->set_variable(bse => BSE::Variables->variables(%opts));
  # in templates
  <:.set level1 = bse.site.children :>
  <:= bse.url(article) | html :>
  <:= tagcats = bse.categorize_tags(article.tag_objects) :>
  <:.if bse.admin:>...
  <:= bse.dumper(somevar) :> lots of noise


DESCRIPTION

Common BSE functionality for use from the new template tags.


COMMON VALUES

bse.site

a BSE::TB::Site object, behaves like an article in owning files and images, and having children.w

bse.url(somearticle)
bse.url(somearticle, extraargs)

Return the article admin link in admin (or admin_links) mode, otherwise the normal article link.

If supplied, extraargs should be a hash containing extra arguments.

bse.admin

Return true in admin mode.

bse.admin_links

Return true in admin_links mode

dumper(value)

Dump the value in perl syntax using the Data::Dumper manpage.

categorize_tags(tags)

Returns the given tags as a list of tag categories, each category has a name (of the category) and a list of tags in that category.

articles
products

The article and product collections.

date(format, when)

Format an SQL date/time.

now(format)

Format the current date/time.


DYNAMIC ONLY VARIABLES

bse.pages(list)
bse.pages(list, options)

Paginate the contents of list.

If options is supplied it should be a hash optionally containing any of the following keys:

Returns a hash with the following keys:


AUTHOR

Tony Cook <tony@develop-help.com>