• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
When do i have to use a Library or Helper?

#1
Hi,

i want to build a price calculation. The calculation consists of 2 components: a product (smartphone) and a smartphone tariff. This 2 things will be needed to calculate the price. I'm not sure how to intgrate this in CI. Should this be a library or a helper and why or is there another solution?

There are some other modules which should be used multiple times on my webpage. Should such modules be libraries?
Reply

#2
Create your own custom library.
Reply

#3
Libraries are php classes
Modules are Classes related to database. CRUD etc...

In your case just create a custom made library for your calcultor.
And setup/configure your helper, these are just methods in helping you in your daily coding...
Also create your Models for database.

Good Luck.
Reply

#4
It seems price calculation is your business logic. So it should be in models, if CI's model is not limited with only database access.

Helpers in CI are global functions. You don't need to create them, unless you really want to use.
Do you want to write tests for your apps? Our book, CodeIgniter Testing Guide would help you.
Reply


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2020 MyBB Group.