function perch_blog_sections($opts = array(), $return = false) { $default_opts = array('template' => 'section_list.html', 'skip-template' => false, 'split-items' => false, 'cache' => true, 'include-empty' => false, 'filter' => false, 'blog' => 'blog'); if (is_array($opts)) { $opts = array_merge($default_opts, $opts); } else { $opts = $default_opts; } if ($opts['skip-template'] || $opts['split-items']) { $return = true; } if (isset($opts['pagination_var'])) { $opts['pagination-var'] = $opts['pagination_var']; } $cache = false; if ($opts['cache']) { $cache_key = 'perch_blog_sections' . md5(serialize($opts)); $cache = PerchBlog_Cache::get_static($cache_key, 10); } if ($cache) { if ($return) { return $cache; } echo $cache; return ''; } $API = new PerchAPI(1.0, 'perch_blog'); $Sections = new PerchBlog_Sections($API); $r = $Sections->get_custom($opts); if ($r != '' && $opts['cache']) { PerchBlog_Cache::save_static($cache_key, $r); } if ($return) { return $r; } echo $r; return false; }