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 7180339
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T17:19:35+00:00 2026-05-28T17:19:35+00:00

I am trying to link my view page to another controller. my test_view.php page

  • 0

I am trying to link my view page to another controller.

my test_view.php page

//this page address is base_url/controller1/function1
<a href='controller1/function2'> test </a>

If i click, the page address will be base_url/controller1/function1/controller1/function2 which is not my desire.

my controller

   //the first function1 is to show my test_view page
    function function1 (){
       $this->load->view('test_view');
    }

   //I can't get to this function2 with the link I used
    function function2 (){
      $this->load->view('funny');
    }

Anyone could help me about this? Thanks a lot.

  • 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-05-28T17:19:36+00:00Added an answer on May 28, 2026 at 5:19 pm

    Sure–you just need to tell CodeIgniter to display the path:

    <a href="<?php echo site_url("controller1/function2");?>">
    

    One thing: This displays the absolute path of your site as defined in your config, not the relative path.

    I prefer relative paths, so I like to create a universal function called site_path to do the same thing without the absolute URL. I include it in one of my universally loaded libraries and it looks something like this:

    function site_path($url) {
        return "/$url";
    }
    

    The benefit of this is that, if I initially develop the site in a subdirectory, I can set site_path to return "/subdirectory/$url" and then just remove the subdirectory once I launch.

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

Sidebar

Related Questions

I get this error when trying to link a win32 exe project. I have
I'm trying to use hook_menu to create a link to a view which takes
Hi i am trying to include a webpage link from another website into my
So I am trying to render a partial view into my page and I
I'm trying to use Html.RouteLink within a view to generate a link to a
I am trying to display my facebook page wall (a link of the form
I am trying to use a template that contains a link such as this:
I'm trying this source where jqGrid gets some json data from django: link Unfortunately
I'm trying to navigate from Home page view to Account page view i.e from
When trying to link some well established tools to my company's active directory, I

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.