Destramic Posted September 23, 2011 Share Posted September 23, 2011 hey guys ive been making and designing my own framwork which isnt far off completion now...im just wondering...do other frameworks have like a action/method which allows you to call another controller in a controller? so bascially in your index page your able to call your news headline, voting poll, search etc...? thanks guys Quote Link to comment https://forums.phpfreaks.com/topic/247742-framework/ Share on other sites More sharing options...
jawef Posted September 24, 2011 Share Posted September 24, 2011 Hello, you are talking about something that today I changed to my framework. I used to give the option to kill current Controller and start new one without redirecting, but that damaged the architecture clearness. So today I replaced that option with regenerating a post (changing what need to be changed) to the new Controller. In that way the user sees the URL that that Controller is responsible and it is really more clear to fallow what happens and where. As for search for example or log in there are some common actions that are handled by the Application Abstract Controller from where Controllers Inherits. Of course there are several other approaches … also I would like to read more opinions on that … Quote Link to comment https://forums.phpfreaks.com/topic/247742-framework/#findComment-1272216 Share on other sites More sharing options...
jawef Posted September 25, 2011 Share Posted September 25, 2011 I must add to my previous answer that regenerating a post to a new Controller is rather a tricky mater. I didn’t found any solution for doing this to what I understand as the proper way (redirecting to new page preserving POST) because sending headers to clients with post doesn’t make sense to it. Of course there are always curl and fsockopen if you want to post and get the contents within the programme but the user want actually redirect. Clarifying that , I ended with my previous approach – holding any post data in season if there is submit through a controller , redirect to the new Controller, use the data of previous Post if there and delete them. That of course exclude posting with redirection to an external page from the application, but for that there is always the option of submitting through curl or fsockopen and get response. Of course that issue arise if you want to submit from inside the application , if you just want give the visitor to submit to other Controller there are numerous ways to do that (Html and Javascript). Quote Link to comment https://forums.phpfreaks.com/topic/247742-framework/#findComment-1272556 Share on other sites More sharing options...
Destramic Posted September 26, 2011 Author Share Posted September 26, 2011 well the way i was thinking of doing is was loading the controller and action though the front controller...and i dunno how your framework operates but you could just include the controller like: $news = new News_Controller(); $news->articles() //retutning all the aticles i dont know if this is a good way of doing things but it would work nicely in my framework Quote Link to comment https://forums.phpfreaks.com/topic/247742-framework/#findComment-1272907 Share on other sites More sharing options...
SparK_BR Posted October 3, 2011 Share Posted October 3, 2011 on mine I have a small script that instantiates the controller, sets the parameters from POST then run the intended action and returns the results already digested by the view. but of course, in the controller I can call another one and make it run something for me, only thing is that I can discard the result or play with the result object. as in like, if you call 'erase' in a group controller, it calls the item controller and erases the itens of that group before commiting suicide. Quote Link to comment https://forums.phpfreaks.com/topic/247742-framework/#findComment-1275254 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.