包含一个公共文件只在一个文件Codeigniter中失败

i am including "navigation.php" which has the common menu in all my views .

<div id="navigation">
    <? include("navigation.php"); ?>
</div>

this code works in every other files but in one file it gives errors .

Severity: Warning
Message: include(navigation.php): failed to open stream: No such file or directory
Filename: views/readsinvo_index.php
Line Number: 2


Severity: Warning
Message: include(): Failed opening 'navigation.php' for inclusion (include_path='.:/usr/share/pear:/usr/share/php')
Filename: views/readsinvo_index.php
Line Number: 2

in "readsinvo_index.php" it is same as the other files

<div id="navigation">
    <? include("navigation.php"); ?>
</div>

and both the files are inside "views" . both files have permission 777 .

But when i tried with

<? include(dirname(__FILE__)."/navigation.php"); ?>

It works perfectly , but in all other pages , it is working when used

<? include("navigation.php"); ?>

is there any possible reason that i cannot include the file normally only in this file . I am using codeigniter framework and CentOS .

You can use APPPATH

APPPATH.'views/navigation.php'

And Possible duplicate of how call another php file to Codeigniter view

CodeIgniter runs from a single entry script file index.php.

So, when you say current directory, it is the path of index.php's directory.

If you include some file, it will first search for any file existing in the given directory, then in include path.

The statement <? include(dirname(__FILE__)."/navigation.php"); ?>

The dirname gives you path of index.php.

When you add statement: <? include("/navigation.php"); ?> in views, it will search for the views directory, hence, the error.