URL Handling |
[eluser]amii[/eluser]
This is my first post so I would like to say hello to everyone. I try to transfer my application to the code igniter framework and the obstacles are URL's. Basically in the old-style application the URL system was sth like this: index.php Code: if(!isset($_GET['p']) || !file_exists('view/'.$_GET['p'].'.php')) {$_GET['p']="main";} Therefore URL's in the old-fashioned style look similar like this: www.example.com/index.php?p=register and afterwards view/register.php has been put in the main content section - that seems to be very simple. This was good due to fact that header.php and footer.php were included only once. However in the code igniter this issue is not so simple at all. I dont have idea how to make this thing works in the same way like in the old-fashioned application, any ideas guys ?
[eluser]Jaketoolson[/eluser]
You'll need to create controllers. http://www.example.com/users/register would load your users.php controller in the /applications/controllers/ folder and /register/ would be a function called register within the users.php controller class. http://ellislab.com/codeigniter/user-gui...llers.html
[eluser]amii[/eluser]
Thanks for the answer Though, I have controller it's called welcome.php it looks like below: However if i try to access: http://127.0.0.1/piotr/seoprecel/index.p...ome/precel //works 100 % http://127.0.0.1/piotr/seoprecel/ //works 100 % http://127.0.0.1/piotr/seoprecel/index.p...ome/precel //no styles, images and js visible http://127.0.0.1/piotr/seoprecel/welcome/precel //got no found error I have a local server apache2 on ubuntu Code: <?php if ( ! defined('BASEPATH')) exit('No direct script access allowed'); .htaccess Code: DirectoryIndex index.php The question is how to make links look like this: http://127.0.0.1/piotr/seoprecel/precel insted of this http://127.0.0.1/piotr/seoprecel/index.p...ome/precel The second question (less important). Is there any technique to include header and footer only once. In my controller they are loaded each time for each site (that's bad for site benchmarking).
[eluser]Jaketoolson[/eluser]
To remove 'index.php' from your url's, you need to make changes to your config.php file. Code: //set this to empty htaccess: Code: RewriteCond %{REQUEST_FILENAME} !-f
[eluser]amii[/eluser]
Unfortunately it doesnt work. You can see the application here seoprecel.net (not all links are marked correct) Only types of links below work correct: http://seoprecel.net/?/welcome/precel http://seoprecel.net/index.php?/welcome/precel
[eluser]toopay[/eluser]
Code: $config['uri_protocol'] = 'AUTO'; Code: $config['uri_protocol'] = 'PATH_INFO'; |
Welcome Guest, Not a member yet? Register Sign In |