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

[eluser]gordon Stewart[/eluser]
Hello.

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.

Code:
if ($this->uri->segment(2) === FALSE)
            {
                $item = 0;
            }
            else
            {
                $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...


Query

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)...
#2

[eluser]tomcode[/eluser]
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:

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));
#3

[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... )
#4

[eluser]tomcode[/eluser]
Post Your

config/routes.php

.htaccess
#5

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

config/routes.php

.htaccess[/quote]

Server = nginx/0.6.32

routes.php >>

Code:
$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)
#6

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


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

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

[eluser]tomcode[/eluser]
Change the entry for the news in Your routes file

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

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

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

[eluser]gordon Stewart[/eluser]
WEIRD WEIRD WEIRD!!!

This code :-

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

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


This code :-

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......

EDIT:-

This code :-

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

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

[eluser]tomcode[/eluser]
I don't know whether that's the cause but Your're using this sign ‘ instead of ' in the code of the rule
#10

[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