When do i have to use a Library or Helper? |
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?
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.
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. |
Welcome Guest, Not a member yet? Register Sign In |