Welcome Guest, Not a member yet? Register   Sign In
Values in URL, but segments are blank. ?

[eluser]gordon Stewart[/eluser]

New problem.

We put in values in URl http://domain.com/news/1

It 'activates' the news function, However the '1' isn't being passed though as a segment value.

if ($this->uri->segment(2) === FALSE)
                $item = 0;
                $item = $this->uri->segment(1);
            echo "ITEM1 = '$item' X<BR>\n";
                $item = $this->uri->segment(2);
            echo "ITEM2 = '$item' X<BR>\n";
                $item = $this->uri->segment(3);
            echo "ITEM3 = '$item' X<BR>\n";
                $item = $this->uri->segment(4);
            echo "ITEM4 = '$item' X<BR>\n";

all the $item values are blank.

my system admin is online now, & i'm chatting - He's trying to figure it out...


1) How can I (as a user / Controller file - Check / de-bug why segments aren't being passed..

2) What can the system administrator do - To debug from a higher level (parts I can't get access to change)...

If URI segments aren't passed, Your routes or Your .htaccess may not be set up right.

To see what's going on, You need access to the code:

$segments = $this->uri->segment_array(); // gives the segments

$segments = $this->uri->rsegment_array(); // gives the segments after routing

// printing nicely to screen :
echo '<pre>' .print_r($segments, true) .'</pre>';

// printing nicely to source :
echo '&lt;!-- ' .print_r($segments, true) .' --&gt;';

// CI logging - requires appropriate settings in the config/config.php
echo log_message('error', 'My Segments ' .print_r($segment, true));

[eluser]gordon Stewart[/eluser]
Segment & rsegment arrays - Blank, Blank, Blank & more blank / nada / zip / zero..

is there anything in the 'admin' side that the administrator can go into the CI code & put 'echo' commands in certain places (or save things to a log report & echo it in the controller / View page... )

Post Your



[eluser]gordon Stewart[/eluser]
[quote author="tomcode" date="1274886273"]Post Your



Server = nginx/0.6.32

routes.php >>

$route['default_controller'] = "root";
$route['scaffolding_trigger'] = "";

$route['safety']    = "root/safety";
$route['about']        = "root/about";
$route['goto']        = "root/goto";

// $route['maps/(:any)'] = "maps/model_maps/$1";
$route['maps/(:any)'] = "maps";

$route['news/(:any)'] = "news/item";

:- admin renamed "welcome" to root...
:- nginx server has no htaccess (It will be ignored)

I've quoted all the routes.php, except the comments (above / below)

[eluser]gordon Stewart[/eluser]
Ps, changed it to :-

$route['maps/(:any)'] = "maps/model_maps/$1";
// $route['maps/(:any)'] = "maps";

Get a 404 error if we add anything after /maps/

Change the entry for the news in Your routes file

// is
$route['news/(:any)'] = "news/item";

// change to
$route['news/(:any)'] = "news/item/$1";

// or change to
$route['news/(:any)'] = "news/item/$2";

[eluser]gordon Stewart[/eluser]

This code :-

$route['news/(:any)'] = "news/item";
// $route[‘news/(:any)’] = "news/item/$1";

Produces all the HTML / PHP output (but still no segments)...

This code :-

// $route['news/(:any)'] = "news/item";
$route[‘news/(:any)’] = "news/item/$1";

White screen on ANY page - no PHP output, No HTML output - Nothing, just a white page......


This code :-

$route['news/(:any)'] = "news/item/$2";
// $route[‘news/(:any)’] = "news/item/$1";

Displays the HTML etc on screen - But still, no segments....

I don't know whether that's the cause but Your're using this sign ‘ instead of ' in the code of the rule

[eluser]gordon Stewart[/eluser]
[quote author="tomcode" date="1274888315"]I don't know whether that's the cause but Your're using this sign ‘ instead of ' in the code of the rule[/quote]

I copied your ’ ’ & replaced all of my quotes..

Uploaded the routes.php file & White screen on ALL pages

(no HTML / PHP / Other output)

Theme © iAndrew 2016 - Forum software by © MyBB