I have a script that handles a bunch of searching and filtering. It’s in
/assets/php/do_search.php, so not part of kirby’s core. So, I start it up with:
define('DS', DIRECTORY_SEPARATOR); require($_SERVER["DOCUMENT_ROOT"] . DS . 'kirby' . DS . 'bootstrap.php'); $kirby = kirby(); $site = $kirby->site(); $params = $_POST; $site->load('models');
I’m able to use Kirby throughout, filtering through pages and returning succinct results. Instead of returning the entire page as a search result, I just return a few strings:
$filtered_result_arr['title'] = (string)$filtered_result->title(); $filtered_result_arr['author'] = (string)$filtered_result->parent()->title(); $filtered_result_arr['categories'] = (string)$filtered_result->get_categories(); $filtered_result_arr['url'] = "/" . (string)$filtered_result->uri();
This is all working, except for the
get_categories() function - which is included in the template’s model. I’ve included
$site->load('models') at the beginning of the script - but this seems to have no effect.
Is there anything I can do here to access the models?