title: create main page with codeigniter
body: <p>How can i create a main page with codeigniter?</p>
  
  <p>That page should contain a few links like login, register, etc.</p>
  
  <p>I followed a tut to create a login screen. But it made codeigniter only for that purpose. This is the site i'm talking about:</p>
  
  <p><a href="http://tutsmore.com/programming/php/10-minutes-with-codeigniter-creating-login-form/" rel="nofollow noreferrer">http://tutsmore.com/programming/php/10-minutes-with-codeigniter-creating-login-form/</a></p>
  
  <p>So basically what im trying to is, use codeigniter for more things than just a login form.</p>
  
  <p>My try routes.php i set these settings:</p>
  
  <pre><code>$route['default_controller'] = "mainpage";
  $route['login'] = "login";
  </code></pre>
  
  <p>My mainpage.php file:</p>
  
  <pre><code>class Mainpage extends Controller
  {
      function Welcome()
      {
          parent::Controller();
      }
  
      function index()
      {
  
          $this-&gt;load-&gt;view('mainpage.html');
      }
  }
  </code></pre>
  
  <p>Mainpage.html:</p>
  
  <pre><code>&lt;HTML&gt;
  
  &lt;HEAD&gt;
  &lt;TITLE&gt;&lt;/TITLE&gt;
  &lt;style&gt;
        a.1{text-decoration:none}
        a.2{text-decoration:underline}
  &lt;/style&gt;
  
  &lt;/HEAD&gt;
  
  &lt;BODY&gt;
  
       &lt;a class="2" href="login.php"&gt;login&lt;/a&gt;
  
  &lt;/BODY&gt;
  &lt;/HTML&gt;
  </code></pre>
  
  <p>Login.php looks exactly like the one in that website which i provided the link for in this post:</p>
  
  <pre><code>Class Login extends Controller
  {
      function Login()
      {
          parent::Controller();
      }
  
      function Index()
      {
          $this-&gt;load-&gt;view('login_form');
      }
  
      function verify()
      {
          if($this-&gt;input-&gt;post('username'))
          { //checks whether the form has been submited
              $this-&gt;load-&gt;library('form_validation');//Loads the form_validation library class
              $rules = array(
                  array('field'=&gt;'username','label'=&gt;'username','rules'=&gt;'required'),
                  array('field'=&gt;'password','label'=&gt;'password','rules'=&gt;'required')
              );//validation rules
  
              $this-&gt;form_validation-&gt;set_rules($rules);//Setting the validation rules inside the validation function
              if($this-&gt;form_validation-&gt;run() == FALSE)
              { //Checks whether the form is properly sent
                  $this-&gt;load-&gt;view('login_form'); //If validation fails load the &lt;b style="color: black; background-color: rgb(153, 255, 153);"&gt;login&lt;/b&gt; form again
              }
              else
              {
                  $result = $this-&gt;common-&gt;login($this-&gt;input-&gt;post('username'),$this-&gt;input-&gt;post('password')); //If validation success then call the &lt;b style="color: black; background-color: rgb(153, 255, 153);"&gt;login&lt;/b&gt; function inside the common model and pass the arguments
                  if($result)
                  { //if &lt;b style="color: black; background-color: rgb(153, 255, 153);"&gt;login&lt;/b&gt; success
                      foreach($result as $row)
                      {
                          $this-&gt;session-&gt;set_userdata(array('logged_in'=&gt;true,'id'=&gt;$row-&gt;id,'username'=&gt;$row-&gt;username)); //set the data into the session
                      }
  
                      $this-&gt;load-&gt;view('success'); //Load the success page
                  }
              else
              { // If validation fails.
                      $data = array();
                      $data['error'] = 'Incorrect Username/Password'; //&lt;b style="color: black; background-color: rgb(160, 255, 255);"&gt;create&lt;/b&gt; the error string
                      $this-&gt;load-&gt;view('login_form', $data); //Load the &lt;b style="color: black; background-color: rgb(153, 255, 153);"&gt;login&lt;/b&gt; page and pass the error message
                  }
              }
          }
          else
          {
              $this-&gt;load-&gt;view('login_form');
          }
      }
  }
  </code></pre>
  
  <p>What am i missing guys?</p>