Welcome Guest, Not a member yet? Register   Sign In
Code Igniter noob :)
#27

[eluser]Bart v B[/eluser]
@Tominator, (hehe nice nickname Wink ) and Mr. Gibson

I not agree with you sorry.
What give you the freedom to just one single controller?
For the record i did not reat the whole topic, so maybe i misunderstoot the real problem.

If it is a small website you don't want to do everything in one controller.
It does not make any sence.

For example:

If you have one controller and the website has for example some main content, contactpage, and guestbook.
how in the world you can understand youre own controller.
A contactpage can send some information, but an guestbook also.

So a better method would be that there is a understanding how the framework works.
The first segment is the controller when it's called.
something like this: http://domain.tld/contact/

that should be not to complicated, because youre controller is contact.
With some code:
Code:
<?php

class Contact extends Controller
{

  //  this is caled if we go to contact/
  function index()
  {
    // we just simple output some html that is in your views folder caled contactpage.php
    $this->load->view('contactpage');
  }

}
CI allows you to use methods. So when you go to /contact/send/ then the controller is caled, and the method that we use is send.

some code
Code:
<?php

class Contact extends Controller
{

  //  this is caled if we go to contact/
  function index()
  {
    // we just simple output some html that is in your views folder caled contactpage.php
    $this->load->view('contactpage');
  }

  // this is the method that wel call if we want to send some data to the server
  function send()
  {
    // do something with the data
    // afther sending we load a new view
    $this->load->view('sendpage');
  }
}
As you see, this is a nicer and easyer way to use. just call a controller, if there is a method call it from the controller/method.

Hope that helps you Wink


Messages In This Thread
Code Igniter noob :) - by El Forum - 04-21-2010, 07:39 AM
Code Igniter noob :) - by El Forum - 04-21-2010, 07:47 AM
Code Igniter noob :) - by El Forum - 04-21-2010, 07:51 AM
Code Igniter noob :) - by El Forum - 04-21-2010, 08:32 AM
Code Igniter noob :) - by El Forum - 04-21-2010, 08:35 AM
Code Igniter noob :) - by El Forum - 04-21-2010, 08:48 AM
Code Igniter noob :) - by El Forum - 04-21-2010, 08:52 AM
Code Igniter noob :) - by El Forum - 04-21-2010, 08:58 AM
Code Igniter noob :) - by El Forum - 04-21-2010, 10:42 AM
Code Igniter noob :) - by El Forum - 04-21-2010, 12:48 PM
Code Igniter noob :) - by El Forum - 04-21-2010, 01:11 PM
Code Igniter noob :) - by El Forum - 04-22-2010, 01:55 AM
Code Igniter noob :) - by El Forum - 04-22-2010, 02:00 AM
Code Igniter noob :) - by El Forum - 04-22-2010, 03:01 AM
Code Igniter noob :) - by El Forum - 04-22-2010, 03:20 AM
Code Igniter noob :) - by El Forum - 04-26-2010, 03:47 AM
Code Igniter noob :) - by El Forum - 04-26-2010, 03:58 AM
Code Igniter noob :) - by El Forum - 04-26-2010, 05:19 AM
Code Igniter noob :) - by El Forum - 04-26-2010, 06:09 AM
Code Igniter noob :) - by El Forum - 04-26-2010, 02:21 PM
Code Igniter noob :) - by El Forum - 04-28-2010, 03:58 AM
Code Igniter noob :) - by El Forum - 04-28-2010, 04:36 AM
Code Igniter noob :) - by El Forum - 04-28-2010, 05:08 AM
Code Igniter noob :) - by El Forum - 04-28-2010, 05:43 AM
Code Igniter noob :) - by El Forum - 04-28-2010, 08:54 AM
Code Igniter noob :) - by El Forum - 04-28-2010, 10:44 AM
Code Igniter noob :) - by El Forum - 04-28-2010, 04:28 PM
Code Igniter noob :) - by El Forum - 04-29-2010, 01:39 AM



Theme © iAndrew 2016 - Forum software by © MyBB