Liquid Fire Posted December 17, 2007 Share Posted December 17, 2007 I am at the point where I am needing to access passed variable in my framework I am building. On the blog tutorial the codeigniter, you access the variables thought the uri_helper class which you can do in my url_helper class however I was wondering if any other frameworks allow to set parameters for controller functions and the framework automatically sets the parameters if the function/method has any? If so how would this be possible is PHP. I was thing I could use the Reflection Class but I here that it is very slow and I don't want to add that type of bottleneck to the application(since a lot of my function would have parameters. Doe anyone know how rails handles this? Quote Link to comment https://forums.phpfreaks.com/topic/82047-accessing-variables-in-mvc-framework/ Share on other sites More sharing options...
Liquid Fire Posted January 9, 2008 Author Share Posted January 9, 2008 Anyone? Do any other frameowrks allow you do pass the url variables in a mvc type url and parameters in controller function or no. is this currently hte standard way of doing thing in a mvc framework: //in controller class public function login() { $username = $this->url_helper->get_variable(1); $password = $this->url_helper->get_variable(2); //code to perform login and whatever } or do others allow: public function login($username, $password) { //code to perform login and whatever } Just wondering if there is a way to automate and allow users to pass controller method parameters and automatically parse the url and pass them to the function. Quote Link to comment https://forums.phpfreaks.com/topic/82047-accessing-variables-in-mvc-framework/#findComment-434705 Share on other sites More sharing options...
dbo Posted January 9, 2008 Share Posted January 9, 2008 I've typically gone with the second option you have there. However, I've been giving some thought to it more recently and think there might be some more value/flexibility in something similar to the first option. I'll try to formulate some more thoughts/specifics when I get a spare moment, but that's my initial thoughts at a glance. Quote Link to comment https://forums.phpfreaks.com/topic/82047-accessing-variables-in-mvc-framework/#findComment-434764 Share on other sites More sharing options...
Liquid Fire Posted January 9, 2008 Author Share Posted January 9, 2008 what framework do you use that allows you to use parameters and automatically parses the from the url adn insert the data into those parameters automatically? Quote Link to comment https://forums.phpfreaks.com/topic/82047-accessing-variables-in-mvc-framework/#findComment-435003 Share on other sites More sharing options...
Liquid Fire Posted January 10, 2008 Author Share Posted January 10, 2008 I figured out the way, by using call_user_func_array() Quote Link to comment https://forums.phpfreaks.com/topic/82047-accessing-variables-in-mvc-framework/#findComment-435517 Share on other sites More sharing options...
448191 Posted January 12, 2008 Share Posted January 12, 2008 Typically I prefer a Request object. It makes for easy testing, and allows your app to be run in a different context. Quote Link to comment https://forums.phpfreaks.com/topic/82047-accessing-variables-in-mvc-framework/#findComment-437098 Share on other sites More sharing options...
Liquid Fire Posted January 12, 2008 Author Share Posted January 12, 2008 Typically I prefer a Request object. It makes for easy testing, and allows your app to be run in a different context. could you give me an example of what you mean? Quote Link to comment https://forums.phpfreaks.com/topic/82047-accessing-variables-in-mvc-framework/#findComment-437263 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.