tpl->setPath($core->tpl->getPath(), $core->templator->path); $core->addBehavior('urlHandlerBeforeGetData',array('publicTemplatorBehaviors','BeforeGetData')); class publicTemplatorBehaviors { public static function BeforeGetData ($_ctx) { global $core; if (array_key_exists($core->url->type,$core->getPostTypes()) || ($core->url->type == 'pages')) { $params = array(); $params['meta_type'] = 'template'; $params['post_id'] = $_ctx->posts->post_id; $post_meta = $core->meta->getMetadata($params); if (!$post_meta->isEmpty() && ($core->tpl->getFilePath($post_meta->meta_id))) { $_ctx->current_tpl = $post_meta->meta_id; } } if (($_ctx->current_tpl == "category.html") && preg_match('/^[0-9]{1,}/',$_ctx->categories->cat_id,$cat_id)) { $tpl = 'category-'.$cat_id[0].'.html'; if (($core->tpl->getFilePath($tpl))) { $_ctx->current_tpl = $tpl; } } } } ?>