BSE::Variables - commonly set variables
# 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
Common BSE functionality for use from the new template tags.
a BSE::TB::Site object, behaves like an article in owning files and images, and having children.w
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.
Return true in admin mode.
Return true in admin_links mode
Dump the value in perl syntax using the Data::Dumper manpage.
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.
The article and product collections.
Format an SQL date/time.
Format the current date/time.
Paginate the contents of list
.
If options
is supplied it should be a hash optionally containing
any of the following keys:
ppname
- the name of the items per page CGI parameter. Default:
"pp".
pp
- the default number of items per page. Default: 20.
p
- the name of the page number CGI parameter. Default: "p".
gap
- the text for the page
value in the page list for gap
entries. Default: "...".
pages_size
- the desired maximum number of entries in the pages
list. Default: 20. This should be at least 10.
Returns a hash with the following keys:
page - the current page number
pagecount - the number of pages.
pp - the number of items per page.
start - the start index within the original list for the items list.
end - the end index within the original list for the items list.
startnum - the starting number within the list for the items list.
Always startindex
+1.
items - a list of items for the current page.
is_first_page - true for the first page.
is_last_page - true for the last page.
next_page - the page number of the next page, 0 if none.
previous_page - the page number of the previous page, 0 if none.
pages - a list of pages, each with the keys:
page - the page number or the gap value if this entry represents a gap.
gap - true if this entry is a gap.
link - true if this entry should be a link. false for gaps and the current page.
pname - the name of the page number parameter
ppname - the name of the items per page parameter
Tony Cook <tony@develop-help.com>