Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8814479
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T04:08:00+00:00 2026-06-14T04:08:00+00:00

I am just getting started with this framework, and I’m fairly new to the

  • 0

I am just getting started with this framework, and I’m fairly new to the MVC concept. Right now I am following the tutorial on the official documentation and my controller looks like this:

class Pages extends CI_Controller {

public function view($page = 'home')
{
    if ( ! file_exists('application/views/pages/'.$page.'.php'))
        {
            // Whoops, we don't have a page for that!
            show_404();
        }

        $data['title'] = ucfirst($page); // Capitalize the first letter

        $this->load->view('templates/header', $data);
        $this->load->view('pages/'.$page, $data);
        $this->load->view('templates/footer', $data);
}

public function goto($page)
{
    if ( ! file_exists('application/views/pages/'.$page.'.php'))
        {
            // Whoops, we don't have a page for that!
            show_404();
        }

        $data['title'] = ucfirst($page); // Capitalize the first letter

        $this->load->view('templates/header', $data);
        $this->load->view('pages/'.$page, $data);
        $this->load->view('templates/footer', $data);
}

}

I have also a home.php file with the homepage:

<?php $this->load->helper('url');?>
<div>
    <p>This is the home page</p>
</div>
    <a href="<?php echo base_url()./index.php/pages/goto/about;?>">About</a>
<div id="content">
    <form method="post" action="">
        <div>
            <label for="username">Username:</label>
            <input type="text" name="username"/>
        </div>
        <div>
            <label for="password">Password:</label> 
            <input type="password" name="password"/>
        </div>
        <div>
            <input type="submit" value="Login"/>
        </div>
    </form> 
</div>

Until now everything works, but how can I add and work with new links? I mean, suppose that you have a list of links in the homepage; when the user clicks on one of those links, how am I supposed to handle the requests? Should I let them go through the “pages” controller? Should I create a new controller for every page of the website?

In the first case (which to me sounds more logical), how can I correctly redirect the user based on the link they clicked on?

Any help would be appreciated.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-14T04:08:02+00:00Added an answer on June 14, 2026 at 4:08 am

    how am I supposed to handle the requests?

    Standard way is controller/methods/ but ofcourse you can use router. Router info

    Should I let them go through the “pages” controller?

    Depends. Is those pages are related to controller? if yes, then include. if no than don’t. Point is, bring together the related contents under one controller. You won’t want say admin functions in page controller. do you?

    Should I create a new controller for every page of the website?

    Simple answer. No. Reason is above.

    In the first case (which to me sounds more logical), how can I correctly redirect the user based on the link they clicked on?

    again the 1st point.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

So I just set up my Cocos2d-x framework on Eclipse by following this tutorial
Have just finished tutorial by Rob Allen: http://akrabat.com/wp-content/uploads/Getting-Started-with-Zend-Framework-2.pdf then i decided to get module
I just started getting this error today, seemingly out of nowhere. Any one see
I'm just getting started on writing functions instead of writing everything inline. Is this
I am just getting started with NHaml and ran into a snag. This is
I'm just getting started with the Play Framework 2.0 (using current trunk 2.1-SNAPSHOT, Scala)
I am just getting started with Backbone.js , but it looks really interesting... Right
I'm just getting started with Ember and come across this issue while writing some
I am just getting started using NAnt. I was working from a tutorial, and
I'm just getting started using Mustache and I have this rendering problem. I send

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.