2 PROCESS 'kpac/parts/util.tt2';
4 # Renders a single 'page' grid
6 MACRO render_kpac_grid(page_id) BLOCK;
7 page = ctx.kpac_config.pages.page.$page_id;
8 ncols = page.columns || 3; # avoid divide-by-zero
11 <table cellpadding="0" cellspacing="0" border="0" class="main_category_table">
14 FOR cell IN page.cell;
21 IF cell.type == 'topic';
22 tpage_id = cell.content;
23 topic_page = ctx.kpac_config.pages.page.$tpage_id %]
25 <td width="[% width %]%"><a href="[% mkurl(ctx.kpac_root _ '/category', {trail => trail_append(tpage_id)}) %]"><img
26 src="[% kpac_img_path(topic_page.img) %]" alt="" /><span>[% topic_page.name %]</span></a></td>
28 [% ELSIF cell.type == 'search'; %]
30 <td width="[% width %]%"><a href="[%
31 mkurl(ctx.kpac_root _ '/results', {query => cell.content, nosprop => 1}, ['page', 'qtype']) %]"><img
32 src="[% kpac_img_path(cell.img) %]" alt="" /><span>[% cell.name %]</span></a></td>
34 [% ELSIF cell.type == 'link'; %]
36 <td width="[% width %]%"><a href="[% cell.content | html %]"><img
37 src="[% kpac_img_path(cell.img) %]" alt="" /><span>[% cell.name %]</span></a></td>