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

  • Home
  • SEARCH
  • 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 9175511
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T16:55:33+00:00 2026-06-17T16:55:33+00:00

<?php class Page extends CI_Controller{ function index(){ $this->view(‘home’); } public function view($page = ‘home’)

  • 0
<?php
class Page extends CI_Controller{

    function index(){
        $this->view('home');
    }

    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);

    }

I want to view the pages with links as http://www.mydomain.com/page/about, http://www.mydomain.com/page/services etc not in format http://www.mydomain.com/page/view/about and http://www.mydomain.com/page/view/services

How can I do so?

  • 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-17T16:55:34+00:00Added an answer on June 17, 2026 at 4:55 pm

    In config/routes.php you can add a route:

    $route['page/(:any)'] = "/page/view/$1";
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am having PHP class class SurveyQuestion extends CActiveRecord { public function relations() {
This is how I set header $this->output->set_status_header('404'); in controller: <?php class custom404 extends CI_Controller
I have a controller for example: class Users extends CI_Controller { function index() {
I have the following controller file: <?php class Test extends CI_Controller { function __construct()
<?php class Page { function getPage($urlOfPage){ $result = mysql_query('SELECT category, title FROM rs-planet WHERE
I have a php class, RegistrationController, <?php class RegistrationController extends ParentController { function __construct()
I have this code, and when I call the function with mydomain/index.php/blog everything works,
I have the following code in a controller: <?php class Student extends CI_Controller {
I'm working with a controller name page.php . This is what I have: class
well i have a class pagination <?php class Pagination { public $current_page; public $per_page;

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.