3 function cms_display($basename, &$tem) {
4 $nav_items = db_get_assocs('cms_pages', "coalesce(nullif(nav_title,''), title) as title,filename", 'where navbar!=0 order by navbar');
6 foreach($nav_items as &$nav_item) {
7 if($nav_item['filename'] == 'index') {
8 $nav_item['filename'] = './';
10 if($nav_item['title'] == '') {
11 $nav_item['title'] = '-- blank --';
14 $tem->set('$navbar_items', $nav_items);
17 $cms_page_id = cms_display_content($tem, 'where filename=%"', $basename);
19 if(logged_in_as_admin()) {
20 $admin_links = array();
22 $admin_links['id'] = $cms_page_id;
24 $tem->set('$admin_links', $admin_links);
34 function cms_display_content(&$tem /*, 'where clause %", %i', string, int */) {
35 $args = array_slice(func_get_args(), 1);
36 $args = array_merge(array('cms_pages', 'id,title,keywords,description,content'), $args);
37 $row = call_user_func_array('db_get_assoc', $args);
39 $tem->set('$cms_title', $row['title']);
40 $tem->set('$meta_keywords', $row['keywords']);
41 $tem->set('$meta_description', $row['description']);
42 $tem->set('$cms_body', $row['content']);