![]() |
HMVC: Maintain current site and only change widget - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20) +--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23) +--- Thread: HMVC: Maintain current site and only change widget (/showthread.php?tid=34426) |
HMVC: Maintain current site and only change widget - El Forum - 09-29-2010 [eluser]breaddes[/eluser] This is a pretty simple HMVC app to explain my problem. This application loads the welcome module in site/welcome first. That's my entry point. Here I get my main content for my site and I additionally run a module called extra which gives me an extra Widgetlike content for my site. Code: <?php My module extra creates a widget partial and makes it as a global string available. Code: <?php This works so far. And if I output my data in my template everything there. Code: <?php $this->load->view('header'); ?> Now what I want to achieve is something tricky. There is a link on the widget which should call the method new() in Extra to change the widgets view. But at the same time I don't want to leave my Welcome site, which is the corresponding current url. If I would just call extra/new I will loose my welcome content which will later be missed in my template. So how can I maintain the current url state and still call another widget? The only thing I can think of is creating another method in Welcome: Code: function other() { That would do exactly what I want. But isn't it overhead to create two methods for every function I want to call. It would also mean that I don't have a good encapsulation of my extra module. HMVC: Maintain current site and only change widget - El Forum - 09-29-2010 [eluser]Phil Sturgeon[/eluser] And this is exactly why people new to CodeIgniter should not be using HMVC. Use a library. Use a view with self-contained PHP code. Use an existing Widget system like wiredesignz or the one from PyroCMS. This is not a way to work ![]() HMVC: Maintain current site and only change widget - El Forum - 09-29-2010 [eluser]joedy[/eluser] You can try to use some jquery functions, such as dialog, load, append, or slideDown/show |