Welcome Guest, Not a member yet? Register   Sign In
Tutorial directory paths/URIs, REVERSED in a few paragraphs—Can somebody tell me WHAT IS GOING ON???
#1

[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?
#2

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

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

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




Theme © iAndrew 2016 - Forum software by © MyBB