Codeignitor custom functions

Hi,

I'm new to codeignitor, and loving it so far...

I'm writing some PHP functions that I need available across my pages, can someone please tell me how to set it up?

I currently have them as a class in  the library, but when I call them I get
"Fatal error: Call to undefined function call_web_api()"

Thanks - first week on a need job, and need to impress!!!  

Cris.
CrisThompsonUKAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

CrisThompsonUKAuthor Commented:
OK, panic over.

I got it working as a helper rather than library file.

Points still available if someone can comment/ guide me if this is correct.

Cris.
0
Ray PaseurCommented:
Usually a sensible design contains a common script file that gets loaded for every request.  This common file creates an "environment" for the page-specific scripts.  It handles things like starting the session, connecting the data bases, retrieving the cookies and locating the client records, if any.  This is a logical place to define your own functions.  If it appears to work better as a "helper" then I think you have your answer.

In object-oriented programming, the encapsulation of code and data is intended to help groups of programmers work together without clobbering each other's work.  If you're the only one working on the project, you can get away with less rigid adherence to principles of OOP.  It would probably be a gross violation of OOP designs to add a global-scope function to a web site.  But it might be expedient, too, if the function is needed on several pages.
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
CrisThompsonUKAuthor Commented:
thanks as ever ray.
0
Ray PaseurCommented:
Thanks for the points and best of luck with the new gig! ~Ray
0
CrisThompsonUKAuthor Commented:
this one's a perm, so I need to brush up on everything!! - Six months probation!
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Web Browsers

From novice to tech pro — start learning today.