• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Any one help please??

I am new to CI and I am just working on my new website with CI . And I got a stopped in one place .I use the same tuts in CI user guide to create a static pages.And as in the user guide in routes.php there we have to make this change to view that static pages from database
$route['(:any)'] = "page/view/$1";

But is there any other way to load this "page/view/$1" .Because (:any) won't let me go to other controller and i don't want to route them manually.Please sir help me to escape from this problem.

There are multiple ways, some of them are better/easier/worse/...

1) Add a route before the (:any) route for every controller you want to access which shall not be static
2) Create a "bootstrap" controller which will replace the "page/view/$1" controller to handle all requests. Inside this you will check first if there is a controller (file) in application/controllers for the first URI-segment. If you found one, load the class (be careful, this one must not extend CI_Controller or MY_Controller since you will get all classes double loaded and will loose data) and see if there is a method equivalent to the second URI-segment. Then you execute this method and return its content. On the other hand, if you didn't find the method, do show_404();. For classes/files/first URI-segment not found as file, try to find the content either in a view file or inside the database (whichever way you store you static content)
3) There was actually a third possibility which I have, however, forgotten Tongue

I personally like method 2 most but it requires some different code to work (since your controllers shall not extend MY_/CI_Controller but still need to be able to access every component of CI (key word get_instance().

Need further help? Send me an email/PM!

Sir will you please elaborate more with some example code match with user guide static page tuts.Thanks in advance

Okay can you tell us what you are doing.
Can you give the scenario, tell us the story.

I am just trying to built a website based in Codeigniter framework..Sir


Okay I think you are confusing yourself.
I suggest you learn first to use the Controller, Model and View.

Do you have the basic idea how this three parts work?
If not then we suggest you read the Documentation regarding these three topic.

Here read this,


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  

  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2020 MyBB Group.