PHP Developers Network

A community of PHP developers offering assistance, advice, discussion, and friendship.
 
Loading
It is currently Fri Dec 19, 2014 12:29 pm

All times are UTC - 5 hours




Post new topic Reply to topic  [ 4 posts ] 
Author Message
PostPosted: Sat Aug 04, 2012 2:17 pm 
Offline
Forum Contributor

Joined: Sat Nov 19, 2011 10:32 am
Posts: 194
Hello - this pertains to CI but i guess the issue is similar for all frameworks.

I am using an authentication library (tank-auth) to handle login/registration etc.
- so i already have an auth controller ( say Controller A) - with a method 'login' - that calls the view 'login-form'.

This is working perfectly well. So far so good

However now i need to show the login form on the top of each page (say on home page) - this home page is controlled by a different controller - say Controller B.

Now how do i call the method in controller B (say the login method) from controller A ?


Top
 Profile  
 
PostPosted: Sat Aug 04, 2012 2:32 pm 
Offline
Forum Contributor

Joined: Sat Nov 19, 2011 10:32 am
Posts: 194
some quick search seems to be pointing out in the direction of modular development (HMVC) - but i am not sure how to apply this to CI.

Isnt' MVC supposed to ease out development ? so wht is the fuss of it not being modular and why cant it handle two or more modules display per page ?


Top
 Profile  
 
PostPosted: Tue Aug 14, 2012 8:06 am 
Offline
Forum Regular
User avatar

Joined: Mon Feb 11, 2008 5:22 am
Posts: 611
Yeah this is something that, for instance, Kohana and Fuel are both set up for. It's been a while since I used CI and this approach may no longer work/may be greeted by cries of anguish because it's some kind of bad practice, but I seem to remember trying to do something similar ages ago with CI. I simply used a wrapper function that instantiated the controller class and called the relevant action, I can't remember if it used output buffering or not, I don't think it was necessary though.


Top
 Profile  
 
PostPosted: Tue Aug 14, 2012 10:58 am 
Offline
Forum Contributor

Joined: Sat Nov 19, 2011 10:32 am
Posts: 194
I eventually did something similar using wrapper of sorts.
and this is one reason why I later moved to YII framework - (widgets and modules are inherently supported) - though i am still trying to figure out YII in its entirety.


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 4 posts ] 

All times are UTC - 5 hours


Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Jump to:  
Powered by phpBB® Forum Software © phpBB Group