Zend framework integration into Kirby header

Has anyone ever integrated elements of zend framework into Kirby. For instance we have headers and a menu system. We want to use Kirby for a portion of our site that we don’t want using a database. We will incorporate the Kirby system into that. Although, we don’t want to create all new headers and menus, but want to call those into the Kirby system. Has anybody every done this and if so, how?

Thanks,

Brandon

So you want to use Kirby in a specific section of the site so that Kirby is one menu entry while the others come from your database?

You can put the Zend Framework in the site/plugins folder of the Kirby installation, which (if done correctly) will load it on every request.
You can then access the methods of the framework from your templates.

Actually the main site is written in Zend, so we will create a new directory /kirby and run the cms from there. Within that we need to call certain Zend framework elements like the header.

Yes, that’s what I thought. Have you tried what I wrote?

Yeah, so I need to load the whole zend framework into plugin, even though it’s already installed outside Kirby?

Oh, and the header we will need to call would not be loaded into plugin, if we load it into plugin, then we would need two copies. One for the site outside of Kirby and another within plugins?

You don’t need to, that’s just one way of doing it. You can also require it from the site/config/config.php file, which will work just fine. You can then also set the framework up in the config.php.

Could you elaborate on how to do this a bit more.

We’ve tried a ton of different things.

One thing we tried was

require_once ‘Zend/Application.php’;

We have a main header and footer we are trying to call from Zend into our header and footer in Kirby.

Are there certain files we should be requiring or something you could elaborate on more. Do you have any examples on how to do this.

Thanks

Does anybody have any examples of having done this?

Thanks @lukasbestle

Something like this

set_include_path(implode(PATH_SEPARATOR, array(          
    realpath('../library'), // Make sure this is the correct path to your library folder
    get_include_path(),
)));

?

I get this

 require_once(Zend/Controller/Action.php): failed to open stream:

Integration with third-party libraries is unsupported. I have and will still try to help you, but I don’t know your setup, so it’s hard to tell.

Regarding the require_once(): Instead of modifying the include path, please try using absolute paths. Kirby provides kirby()->roots()->index() (the root path of the Kirby installation), you can work from there.