Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

General Questions /

General questions about getting started with SilverStripe that don't fit in any of the categories above.

Moderators: martimiz, Sean, biapar, Willr, Ingo, swaiba, simon_w

Integrating Zend classes to Silverstripe


Reply


5 Posts   696 Views

Avatar
ville

Community Member, 5 Posts

16 July 2012 at 6:34am

Hello,

I'm would like to know how to integrate Zend libraries to Silverstripe? I would appreciate if somebody has a proper example.

Best regards.

Avatar
Willr

Forum Moderator, 5513 Posts

16 July 2012 at 7:29pm

Normally you can just put the libraries in a folder (our standard is to use thirdparty) and use a require() call. Several modules (including the core framework) include thirdparty (and specifically Zend) classes like this

A couple examples:

SS Config - https://github.com/silverstripe/sapphire/blob/master/core/manifest/ConfigManifest.php#L179
Twitter module - http://svn.rentbox.co.nz/public/twitter/trunk/

Avatar
ville

Community Member, 5 Posts

17 July 2012 at 9:17pm

Thanks!

btw. where is "the right place" to globally include the Zend Framework into SilverStripe? Embedding just in a controller file?

Avatar
martimiz

Forum Moderator, 1132 Posts

18 July 2012 at 4:39am

For the frontend, the Page_Controller init() function is one of those places...

Avatar
Willr

Forum Moderator, 5513 Posts

18 July 2012 at 5:35pm

Edited: 18/07/2012 5:36pm

You should include it when you need it. If you only need it for 1 small function, include it in that function, otherwise you can include it in your _config.php file (so it's available early on) the issue with init() is that it is only called as part of the controller request process for *that* controller.