Friday, July 2, 2010

Including an External Library file that has functions that aren't in a class?

I have a need to include certain library files from various php
projects where it has a source file with the functions that are to be
called not within classes... I have been reading on how to do this and
have tried the method of placing the file in the vendor folder and
including it through:

App::import('Vendor', 'libraryfile') ;

However, when I try to call functions from within my cakephp
controller (within a function in a class) it is unable to find the
function.. Its not under my control that the library file isn't within
a class structure as these are just open source libraries and I don't
have time to go through and re-write the code to suit cakephp
protocols... I am hoping someone could provide some insight into
this..

Lets say I have a function within my library file as such:

testfunction () {
}

How would I call this within my controller, if I included it using the
vendor method? If that method won't work, is there another way to do
this include? Thanks

Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions.

You received this message because you are subscribed to the Google Groups "CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to
cake-php+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en

No comments: