2- If one ViewResolver can resolve the view name, he must proceed to use a View Class to render the view. If the View Class is template based, it need to find the real path for the template to make it simply for the view class, if the template no exist, he could said 'No' as response to if he can resolve a view or raise an exception
3- The View Class only need to load the template if it's a template based View Class and render the model.
Yes, in the case of 2) this is more or less what is happening. The problem comes into 3), at least for Skittle, since Skittle is capable of loading sub views. I need to find a way to configure Skittle's resource locator for its own internal use *after* it has been given the full path to the initial template by the ViewResolver.
I think I have enough feedback from you on the fact that this isn't really a nice solution in your opinion. And I pretty much agree. It was experimental but it worked at least to get me to where I am now but I knew I wanted to find a better solution.
I think that I am going to try and experiment with a view factory, maybe as an alternative to viewClass? i.e., for a simple view 'viewClass' => 'someViewClass' might work, but 'viewFactory' => $context->ref('mySkittleViewFatory').
if ( $this->viewClass ) {
return new $this->viewClass($viewName, $viewUri);
} elseif ( $this->viewFactory ) {
$viewFactory = $context->get($this->viewFactory);
// halo_IViewFactory should have create($viewName, $viewUri) with @return halo_IView
return $viewFactory->create($viewName, $viewUri);
}
This way I could create halo_SkittleViewFactory and configure it like:
$context->add('mySkittleViewFactory', array(
'className' => 'halo_SkittleViewFactory',
'constructorArgs' => array(
'resourceLocator' => $context->ref('myViewResourceLocator'),
),
));
What about lithe, it's halo or a frontend to halo. Why a sepparated project, the functionalities of lithe couldn't live on halo project without be an external project that need to maintain?.
Many people in PHP land have never used anything like Substrate or Halo. Of all of the people who have downloaded both (I'd say there have been 200-500 downloads) there have been only two or three people who ever even asked me questions about them. You're the only person (to the best of my knowledge) who really understood it (or knew what to look for) to try and make it work.
Someone like you can use Halo as it is in your own project. And you probably like that a lot. You sort of took the basic example of a single site and ran with it. Tweaked it to make it look like you wanted because you dug into the code and had previous knowledge of some of the things I modeled this after.
The things I intend to do in Lithe would potentially not be things that would work well for your specific project(s). Many things turned on by default, preconfigured, things in specific places... For instance, I know you initially wanted your projects to be structured with resources in WEB-INF/, etc. I may want to nudge people in the direction of using Repose for ORM. Maybe another lite data access layer as well for hand coding SQL queries. These things are not appropriate, in my opinion, to be included in Halo itself.
One of the big strengths I see in both Substrate and Halo is that unlike almost ever other web framework in PHP land they are very open to allow the developer to do whatever they want, however they want. As long as you like to work in IoC/DI type containers and work in interfaces, that is. I think people would like it eventually, but it is not easy to jump into. People in PHP land generally don't like getting a /lib/ folder full of halo_* libraries... what are they going to do with that?
That is where Lithe would come in. It would come with Substrate and Halo, of course, but tucked away in a vendors folder. The main code ( lib/, controllers/, views/, etc. ) would all be standardized and mostly empty. It would all be based on a Substrate context but that would not be really very important to anyone using Lithe just as a simple web application framework. However, once they move behind the default Lithe configuration (like they want to do something super specific), they'd be able to leverage the fact that they can create their own handler mappings, view resolvers, handler adapters, etc., not to mention all of the benefits of the IoC/DI container.
So yeah, Lithe is really just a reference implementation of a webapp written around Halo. A starting point/example. Since there are going to be some hardcoded things that will make the overall application less flexible (at least out of the box) I want to keep it separate from Halo.
I'm showing you some Lithe things now because there are examples that fit some of what we're talking about. Where it makes sense, stuff I've done for Lithe may be put into Halo itself. But only if it is considered generic enough and doesn't impose any specific design principles on users of Halo.
Does that make more sense?
I hope to have Lithe "Single Site" implementation completed soon. I'll share that when it is done.
Thanks again for all of your feedback. I really do appreciate it!