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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T03:13:13+00:00 2026-06-06T03:13:13+00:00

I wanted to ask if there is any way i can get path of

  • 0

I wanted to ask if there is any way i can get path of my view file in controller. For example

class welcome extends controller{

  function __construct(){
       parent::__construct();
  }
  function index(){
     $this->load->view('welcome_message');
  }
  function test(){
     $my_variable = $this->load->view('welcome_message','',TRUE);
  }
  function another_test(){
        ///  $path_to_view = ???;
        ///  echo $path_to_view;
  } 
}

i want to ask if there is any helper function to get this. The test method has variable containing the html contents in it. But i want to get path of view file???

  • 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-06T03:13:16+00:00Added an answer on June 6, 2026 at 3:13 am

    I’m not sure if this is a proper way but you can try this, just create a helper file i.e. my_helper.php in your application/helper folder and paste following function in this helper file

    function get_view_path($view_name)
    {
        $target_file=APPPATH.'views/'.$view_name.'.php';
        if(file_exists($target_file)) return $target_file;
    }
    

    To use it you have to load the helper file first and then call the function with the name of the view as the function’s argument

    $this->load->helper('my_helper');
    $path_to_view = get_view_path('welcome'); // Will return the path if welcome.php exists in the view folder.
    

    You can auto load it using config.php’s $autoload['helper'] = array('functions_helper');

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

Sidebar

Related Questions

I wanted to know if there is any way to call a contact by
I wanted to ask if there is a list of annotations for Scala 2.8.0?
just wanted to ask where I define initial class properties? From other languages I
I am new to Windows phone 7 . I wanted to ask if there
I wanted to ask for some help. I know, that there are a lot
Are there any known methods that can be used to make your software immune
I found this older article how-to-monitor-the-computers-cpu-memory-and-disk-usage-in-java and wated to ask, if there is something
Just wanted to ask you about the drawbacks (I mean memory or reponse time)
I wanted to ask, how to implement an AdListner for Admob. I want the
I wanted to ask whether the following statement where printf() has been provided with

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.