Welcome Guest, Not a member yet? Register   Sign In
where to put and how to call function
#1

Hello Everyone!

I'm new to CodeIgniter (MVC) framework.

I just want to ask where do I put my function so that  can use it in every View. 
like for example I have function that convert  number in to another number, an i need to use it n another view.

the function is long and I don't want to copy it in every view

thanks
Reply
#2

Create a helper function:
https://codeigniter.com/user_guide/gener...ng-helpers
and load it before using it:
https://codeigniter.com/user_guide/gener...ng-helpers

If you use it in every request, you can autoload the helper:
https://codeigniter.com/user_guide/gener...ng-helpers
Reply
#3

Thank you..
Reply
#4

The placement and invocation of a function depend on the programming language and the specific context of your code. Typically, functions are defined at the beginning or within the scope where they will be used and called wherever their functionality is needed.GB whatsapp apk
Reply




Theme © iAndrew 2016 - Forum software by © MyBB