Getting Value in index file |
[eluser]anishpsla[/eluser]
Hi, I am new to Codeigniter. I need a help to get value from GET. I have code to get value from www.mysite.com/index.php/home/index/value in home controller. I want to Display 'Value' in www.mysite.com/index.php/home/value or www.mysite.com/index.php/value or www.mysite.com/value (URL Rewrite enabled). Where home is the default_controller. My working code is added below. Code: <?php
[eluser]anishpsla[/eluser]
Hi, I didn't understand anything. I am new to codeigniter. I have some experiance in php. But I can't get anything usefull ftom the link. Please help me by posting sample code. Also how Codeigniter know value after / is a function in controller or GET data ? That's the real problem for me. It always think www.mysite.com/index.php/value is another function in home controller. But www.mysite.com/index.php/home/index/value will work. Because it's clear that in home controller after index function, value is a GET item.
[eluser]InsiteFX[/eluser]
Code: // controller/function/segment
[eluser]anishpsla[/eluser]
Good one. But Still I need to add default_controller in address. Without that I am getting 404 error. I need something like this. www.mysite.com/test I want to get value of test. Now this one is working www.mysite.com/default_controller/test.
[eluser]InsiteFX[/eluser]
./application/config/routes.php Code: $route['test/(:any)'] = 'test/$1'; See: CodeIgniter Users Guide - URI Routing
[eluser]anishpsla[/eluser]
Sorry to say, I am still getting 404 Page Not Found The page you requested was not found. Code: Class test extends CI_Controller :::: EDIT :::: ========== Finally I got the answer just add Code: $route['(:any)'] = 'test/index/$1'; |
Welcome Guest, Not a member yet? Register Sign In |