Welcome Guest, Not a member yet? Register   Sign In
When to use a controller and when to use a controller/function??
#1

[eluser]123wesweat[/eluser]
Hi,

I am wondering when to make a controller and when to make a function??

For example, i have a register form should i make

./register
or
./welcome/register

So a register.php in controllers or a function register in welcome.php???

Also in general should i make a controller for each page:
./about
./contact
./services

Or should i make functions??

Or should i make a models/register.php??

grtz,
#2

[eluser]Cro_Crx[/eluser]
Generally A controller will relate to an object in your website/application. If you work out which URL's you're going to use it usually makes it a lot easier. For example, for register I would want the url /register. This means that register belongs in it's own controller. The same for about/contact/services.

You'd want to use functions for pages that will group together. For example if you had a User controller, the pages for 'Create User', 'Update User', and 'Delete User' would all be functions within that controller.

Ultimately there's no real answer to what you are asking though so you can group pages under controllers how you'd like.




Theme © iAndrew 2016 - Forum software by © MyBB