开发者

converting from php $_GET variables to code igniter

开发者 https://www.devze.com 2023-01-28 09:58 出处:网络
I am le开发者_开发技巧arning to use the CodeIgniter framework. I am coming form a world where get variables determined which body file to include in the index.php.

I am le开发者_开发技巧arning to use the CodeIgniter framework. I am coming form a world where get variables determined which body file to include in the index.php.

So with the MVC style coding I am unsure how to have a skeleton view which subsequent views are just the body of the page.

any Ideas?


My suggestion is to try and load multiple views based on the data being sent through the $_GET variable. The documentation for CodeIgniter explains how to do this:

http://codeigniter.com/user_guide/general/views.html

The skeleton parts of your site would always be loaded by the controller with the part that changes dependent on the $_GET data.


In CodeIgniter, GET variables(as in querystrings, eg. ?var1=alice&var2=bob) are not normally used for passing data, because they are disabled by default. Instead, URL segments (see http://codeigniter.com/user_guide/general/controllers.html#passinguri) or POST variables are used.

If it is necessary to use GET variables, thus enabling use of $_GET and/or $this->input->get(...), see this:

How can I use GET forms with CodeIgniter?

Edit: This may be useful in regards to loading a subv-iew within a main view:

http://codeigniter.com/wiki/Header_and_footer_and_menu_on_every_page/

0

精彩评论

暂无评论...
验证码 换一张
取 消