CodeIgniter Forums
Tutorial directory paths/URIs, REVERSED in a few paragraphs—Can somebody tell me WHAT IS GOING ON??? - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23)
+--- Thread: Tutorial directory paths/URIs, REVERSED in a few paragraphs—Can somebody tell me WHAT IS GOING ON??? (/showthread.php?tid=55758)



Tutorial directory paths/URIs, REVERSED in a few paragraphs—Can somebody tell me WHAT IS GOING ON??? - El Forum - 11-08-2012

[eluser]SimonLove2009[/eluser]
I've been trying to follow the introductory tutorial, but it's totally confusing:—

Adding logic to the controller:

Earlier you set up a controller with a view() method. The method accepts one parameter, which is the name of the page to be loaded. The static page templates will be located in the application/views/pages/ directory.

Yes I've done that:— I've created a directory called pages in views and put about.php and home.php inside this directory. Now for the totally confusing bit:

Routing

The controller is now functioning! Point your browser to [your-site-url]index.php/pages/view to see your page. When you visit index.php/pages/view/about you'll see the about page, again including the header and footer.

It's suddenly morphed from views/pages into pages/view—WHAT IS GOING ON? IS THIS A MISTAKE?


Tutorial directory paths/URIs, REVERSED in a few paragraphs—Can somebody tell me WHAT IS GOING ON??? - El Forum - 11-08-2012

[eluser]jprateragg[/eluser]
Can you post your code?


Tutorial directory paths/URIs, REVERSED in a few paragraphs—Can somebody tell me WHAT IS GOING ON??? - El Forum - 11-08-2012

[eluser]SimonLove2009[/eluser]
Hi

I've just realised I made a really stupid mistake of putting html code into the pages.php file in controllers—REALLY DUMB and STUPID mistake. I'll have to learn to pay more attention.

BTW When I enter the URI = http://codeigniter:8888/ It loads the header.php and footer.php and home.php just fine like it's mean to. However, when I put http://codeigniter:8888/about.php, it gives me = The requested URL /about.php was not found on this server. Why is this? What URL path would I have to put to get about.php?

Thanks for your patience and help

Kind regards

Simon


Tutorial directory paths/URIs, REVERSED in a few paragraphs—Can somebody tell me WHAT IS GOING ON??? - El Forum - 11-08-2012

[eluser]jprateragg[/eluser]
Your URLs are always:

domain.com/index.php/controller/method

or

domain.com/controller/method

(depends on your config/mod_rewrite,etc.

So, to view your about page, you would more than likely have to go to http://yourdomain.com/pages/about.