Love Fuel?    Donate

FuelPHP Forums

Ask your question about FuelPHP in the appropriate forum, or help others by answering their questions.
Widgets
  • Hi dear friends.
    I'm deciding to develop my own CMS base FuelPHP.
    For first step i create a class Controller_Public which every Front Controller will derive.
    In After method of Controller_public if main request is down the class should load some widgets and render them in partials.
    Widgets are only responsible for presenting data and they will be in Module's Views folder.
    I decide to use ViewModels as widgets.
    the problem is i can't load a ViewModel outside of current Module namespace.
    for example the main request is showing a blog post using a Module named "Content" and i want to render a widget that shows list of galleries from another Module "Gallery".
    how could i forge a ViewModule from another namespace.

  • You should do an HMVC request to a controller in the "gallery" module that will return the Viewmodel object.

    You should not call cross-context, that would cause your code to be tightly coupled. HMVC calls can be routed, so it's easy to have the call routed to another controller if you want to change functionality, without having to go through your code to change everything...
  • Thank you for your answer but is it sufficient to make an HMVC request for every single widgets? 
  • What do you mean by sufficient?

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

In this Discussion