CodeIgniter Forums

Full Version: Repetitive URL
You're currently viewing a stripped down version of our content. View the full version with proper formatting.

El Forum

[eluser]Unknown[/eluser]
Try going to this link:
http://codeigniter.com/bug_tracker/bug_t...ug_tracker
It works, even though it shouldn't, and it happens with my CI site too.

Anyone has a simple solution to this problem?

El Forum

[eluser]Tom Schlick[/eluser]
do you have a function in your controller named bug_tracker? (the constructor)

El Forum

[eluser]Unknown[/eluser]
No, that's just a url on this site. For my site I have a controller name "Articles" , and when I type http://mysite.com/articles/articles/articles , it works. I know it's not a serious problem but I need to fix it anyway.

El Forum

[eluser]Tom Schlick[/eluser]
can you paste the controller code here. and your routes.php file if you have made any customization to it

El Forum

[eluser]khagendra[/eluser]
This is not so bog problem. The reason may be as follows
1 suppose there is a function with parameter and if we are invoking this function without passing any arguments then the Severity: Warning will occur.

2. suppose there is a function with no parameter and if we are invoking this function passing any arguments then the function will executes ignoring the parameters.
so, http://sitename/controllerName/controllerName/ will executes as the index() function of the controller executes ignoring rest of the uri segment.

you can test this trying the code as i have explained.

Example1:

class Test extends Controller
{
function Test()
{
parent::Controller();
}

function index()
{
echo "hi";
}

function show($s)
{
echo $s;
}
}

Try with http://sitename/test/show, it will generates error.

Example2:

class Test extends Controller
{
function Test()
{
parent::Controller();
}

function index()
{
echo "hi";
}

function show()
{
echo $s;
}
}

Try with http://sitename/test/show/show/show, it will works.
hope this will help to understand.

El Forum

[eluser]khagendra[/eluser]
[quote author="khagendra" date="1255560732"]This is not so bog problem. The reason may be as follows
1 suppose there is a function with parameter and if we are invoking this function without passing any arguments then the Severity: Warning will occur.

2. suppose there is a function with no parameter and if we are invoking this function passing any arguments then the function will executes ignoring the parameters.
so, http://sitename/controllerName/controllerName/ will executes as the index() function of the controller executes ignoring rest of the uri segment.

you can test this trying the code as i have explained.

Example1:

class Test extends Controller
{
function Test()
{
parent::Controller();
}

function index()
{
echo "ci forum";
}

function show($s)
{
echo $s;
}
}

Try with http://sitename/test/show, it will generates error.

Example2:

class Test extends Controller
{
function Test()
{
parent::Controller();
}

function index()
{
echo "ci forum";
}

function show()
{
echo "it will works";
}
}

Try with http://sitename/test/show/show/show, it will works.
hope this will help to understand.[/quote]