I wrote an addon to provide rss feeds as api endpoints. It works fine, if I call it through the API.
Before returning the output, I change the document mime type to rss:
If I call it with Lime, I get a Warning: Creating default object from empty value in E:\github\cockpit\addons\Feed\bootstrap.php on line 23.
My folder structure is the following:
.../cockpit/
.../frontend/
-feed.php
content of feed.php
<?php
// error_reporting(0); // hide warning at top of xml feed
//include cockpit
include_once('../cockpit/bootstrap.php');
$app = new Lime\App();
$app->bind("/", function() use($app) {
// $app->response->mime = 'rss'; // set mime type manually
return cockpit('feed')->feed('pages');
});
$app->run();
Has someone a hint, how to set the mime type in a better way?
there is no response object, because you use cockpit as a libary here. $this->app->response->mime = 'rss'; should only be used in route bindings ($app->bind("/", ...))