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="[% mkurl(ctx.kpac_root _ '/results', {query => cell.content}, ['page']) %]"><img
31 src="[% kpac_img_path(cell.img) %]" alt="" /><span>[% cell.name %]</span></a></td>
33 [% ELSIF cell.type == 'link'; %]
35 <td width="[% width %]%"><a href="[% cell.content | html %]"><img
36 src="[% kpac_img_path(cell.img) %]" alt="" /><span>[% cell.name %]</span></a></td>