Modular Extensions - Version 4.3 |
[eluser]gerben[/eluser]
Is there a way I can use the view library (http://ellislab.com/forums/viewthread/49910/) with ME?
[eluser]wiredesignz[/eluser]
I'm sure there is but a View library is central to the entire application so would be an application/library rather than a module. I use my own View Object if you're interested. http://codeigniter.com/wiki/View_Object/ Funnily enough it was designed to work with Matchbox modules :lol: To use it simply load the modules into the View Object. Each module requires a render() function. Code: $this->view->load(array('header' => modules::load('header')));
[eluser]gerben[/eluser]
Looks interesting, your view object! I'll give it a spin! Still I would like to be able to use the view library in a ME module (as an application/library), because I've used it throughout the rest of my existing application. So instead of going: Code: $data = array('bla'=>$bla); I would like to do this: Code: $this->view->set('bla', $bla); Is that possible in any way?
[eluser]wiredesignz[/eluser]
Yes, it is possible to access the View Object from within a module. It is available to Controllers, Models, Modules etc throughout your application.
[eluser]gerben[/eluser]
When I try to do that, my application goes into a loop. ok: Code: $data = array('posts'=>$posts); not ok: Code: $this->view->set('posts', $posts); Anyway, it's not a big deal, but it just would be nice if I could use the view library.
[eluser]wiredesignz[/eluser]
With $this->view being an object there is no reason to use return. Although I'm not sure if that is your problem.
[eluser]Gjoko Pargo[/eluser]
Has anyone tried to load a language file from the modules directory? This doesn't seem to work for me. I have the following structure: Code: /application Code: $this->lang->load('setlanguage', 'english'); And also one more question. I am trying to make as much of the modules (aka partials) as I can for future re-use. This 'setlanguage' module is one of them. The logic is the following: - create view with URL that lead to the language changer file - after the change of language, redirect to wherever the user came from Unfortunately, the link site_url().'/language/setlanguage/english' gives me 404. By now it became obvious to me that I cannot call a partial directly from the URL. But... I am puzzled how to accomplish a call to a partial without putting some special function in each controller which will handle the request. The ultimate goal is 'copy partial dir to new project - call from view - forget it' or am I unrealistic? Could this be achieved?
[eluser]wiredesignz[/eluser]
Loading module language can only be done from within a module. Inside a controller still uses application/language. You could add a module as a controller then load module language. Calling a module still needs handling in your Controller, Have you considered using the MY_Controller extension to do this, then extend page Controllers from MY_Controller? I'm also looking at Khaos events manager to load modules on demand. Stay tuned.
[eluser]Gjoko Pargo[/eluser]
@wiredesignz Well, I am trying to load the language file from within the module. And it gives me that crappy error message. But never mind, it's 5am here and I haven't got my good night sleep, still digging the midnight oil, so it's plausible I am screwing something up. ![]() About the second question, I really don't understand what am I going to accomplish by extending the core controller... Could you please explain... khm... with an example... ;-) Thanks!
[eluser]Gjoko Pargo[/eluser]
@wiredesignz Hm.. I've done some thinking. Are you suggesting I should extend the core controller to MY_Controller, then load each ME I share within my controllers into the MY_Controller constructor and then extend all of my controllers from this one? Darn... even reading what I've just wrote makes me dizzy. :cheese: |
Welcome Guest, Not a member yet? Register Sign In |